diff options
-rwxr-xr-x | bin/pacman-offline | 6 | ||||
-rwxr-xr-x | systemd/pacman-offline | 2 | ||||
-rw-r--r-- | systemd/pacman-offline-reboot.service | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/bin/pacman-offline b/bin/pacman-offline index 57024f0..1a3acf9 100755 --- a/bin/pacman-offline +++ b/bin/pacman-offline @@ -78,7 +78,11 @@ ln -sf /var/cache/pacman/pkg /system-update # reboot if requested if [ ${REBOOT} -eq 1 ]; then - systemctl soft-reboot + if systemctl --dry-run soft-reboot 2>/dev/null; then + systemctl soft-reboot + else + systemctl reboot + fi # start timer if requested elif [ ${TIMER} -eq 1 ]; then systemctl start pacman-offline-reboot.timer diff --git a/systemd/pacman-offline b/systemd/pacman-offline index 48692eb..b3db182 100755 --- a/systemd/pacman-offline +++ b/systemd/pacman-offline @@ -25,7 +25,7 @@ pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade pacman --sync --noconfirm --clean # reboot -if [ -s "/usr/lib/modules/$(uname -r)/pkgbase" ]; then +if [ -s "/usr/lib/modules/$(uname -r)/pkgbase" ] && systemctl --dry-run soft-reboot 2>/dev/null; then systemctl soft-reboot else systemctl reboot diff --git a/systemd/pacman-offline-reboot.service b/systemd/pacman-offline-reboot.service index 7026061..f7f3612 100644 --- a/systemd/pacman-offline-reboot.service +++ b/systemd/pacman-offline-reboot.service @@ -4,4 +4,4 @@ ConditionPathExists=/system-update [Service] Type=oneshot -ExecStart=/usr/bin/systemctl soft-reboot +ExecStart=/bin/sh -c "if systemctl --dry-run soft-reboot 2>/dev/null; then systemctl soft-reboot; else systemctl reboot; fi" |