|
8 | 8 | # shellcheck source=../../../helper-scripts/usr/libexec/helper-scripts/as_root.sh |
9 | 9 | source /usr/libexec/helper-scripts/as-root.sh |
10 | 10 |
|
11 | | -leaprun_exe="$(which leaprun)" |
12 | | -# If privleap is installed and usable by the current user, use that, otherwise |
13 | | -# try to run the script directly. This allows upgrade-nonroot to work even if |
14 | | -# privleapd isn't running or the root user has no privleap socket. |
15 | | -if [ -n "${leaprun_exe}" ] \ |
16 | | - && [ -f "/etc/privleapd/pid" ] \ |
17 | | - && [ -d "/proc/$(cat /etc/privleapd/pid)" ] \ |
18 | | - && [ -e "/etc/privleapd/comm/$(id -nu)" ]; then |
19 | | - "${leaprun_exe}" apt-get-update-plus-dist-upgrade |
20 | | -else |
| 11 | +## If privleap is installed and usable by the current user, use that, otherwise |
| 12 | +## try to run the script directly. This allows upgrade-nonroot to work even if |
| 13 | +## privleapd isn't running or the root user has no privleap socket. |
| 14 | + |
| 15 | +if ! command -v leaprun >/dev/null ; then |
21 | 16 | as_root |
22 | 17 | exec /usr/bin/apt-get-update-plus dist-upgrade |
23 | 18 | fi |
| 19 | +## This is never reached if running 'exec' above. |
| 20 | + |
| 21 | +if ! [ -f "/etc/privleapd/pid" ] ; then |
| 22 | + echo "$0: ERROR: code 1: TODO" |
| 23 | + exit 1 |
| 24 | +fi |
| 25 | + |
| 26 | +if ! [ -d "/proc/$(cat /etc/privleapd/pid)" ] ; then |
| 27 | + echo "$0: ERROR: code 2: TODO" |
| 28 | + exit 1 |
| 29 | +fi |
| 30 | + |
| 31 | +if ! [ -e "/etc/privleapd/comm/$(id -nu)" ]; then |
| 32 | + echo "$0: ERROR: code 3: TODO" |
| 33 | + exit 1 |
| 34 | +fi |
| 35 | + |
| 36 | +exec leaprun apt-get-update-plus-dist-upgrade |
0 commit comments