diff options
Diffstat (limited to 'update-me.in')
-rw-r--r-- | update-me.in | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/update-me.in b/update-me.in index a2210a4..77bf0fc 100644 --- a/update-me.in +++ b/update-me.in @@ -42,6 +42,10 @@ preCmds=('uname -n') cmds=() postCmds=('sync') +if command -v simply-report-installed-packages >/dev/null; then + postCmds+=('simply-report-installed-packages') +fi + for mp in '/' '/boot'; do mountpoint -q "${mp}" || continue mount \ @@ -53,12 +57,12 @@ for mp in '/' '/boot'; do preCmds+=('mount -o remount,rw '"${mp}") if command -v shutdownasap >/dev/null; then if command -v screen >/dev/null; then - postCmds+=('mount -o remount,ro '"${mp}"' || screen -d -m shutdownasap -r') + postCmds+=('mount -o remount,ro '"${mp}"' || screen -d -m shutdownasap -R') else - postCmds+=('mount -o remount,ro '"${mp}"' || shutdownasap -r') + postCmds+=('mount -o remount,ro '"${mp}"' || shutdownasap -R') fi else - postCmds+=('mount -o remount,ro '"${mp}"' || reboot') + postCmds+=('bash -c "mount -o remount,ro '"${mp}"' || reboot"') fi done @@ -66,18 +70,25 @@ if command -v check-kernel >/dev/null; then postCmds+=('check-kernel -r') fi -if command -v /usr/share/archlinux/contrib/admin/checkservices >/dev/null; then - postCmds+=(/usr/share/archlinux/contrib/admin/checkservices) +if command -v checkservices >/dev/null \ +&& command -v systemctl >/dev/null; then + postCmds+=('checkservices') fi command_needs_root() { local cmd - cmd="$1" - cmd="${cmd%% *}" - cmd="${cmd##*/}" - if [ "${cmd}" = 'mount' ] \ - || [ "${cmd}" = 'checkservices' ] \ - || [ "${cmd}" = 'check-kernel' ]; then + cmd=$( + printf '%s\n' "$1" \ + | sed ' + s@^bash -c "\(.*\)"$@\1@ + s@ .*$@@ + s@^.*/@@ + ' + ) + if [ "${cmd}" = 'checkservices' ] \ + || [ "${cmd}" = 'check-kernel' ] \ + || [ "${cmd}" = 'mount' ] \ + || [ "${cmd}" = 'report-installed-packages' ]; then return 0 else return 1 @@ -167,7 +178,7 @@ then cmds=('pacman -Syu' 'pacdiff') elif [ -d '#ETCDIR#/ports' ] then - cmds=('ports -u' 'prt-get --install-scripts sysup' 'rejmerge' 'revdep') + cmds=('ports -u' 'prt-get --install-scripts sysup' 'rejmerge' 'revdep' 'makekernel') elif [ -d '#ETCDIR#/apt' ] then cmds=('apt-get update' 'apt-get upgrade' 'apt-get dist-upgrade' 'apt-get autoremove') |