aboutsummaryrefslogtreecommitdiffstats
path: root/systemd/pacman-offline
diff options
context:
space:
mode:
Diffstat (limited to 'systemd/pacman-offline')
-rwxr-xr-xsystemd/pacman-offline16
1 files changed, 10 insertions, 6 deletions
diff --git a/systemd/pacman-offline b/systemd/pacman-offline
index 9471bfc..9bae2ee 100755
--- a/systemd/pacman-offline
+++ b/systemd/pacman-offline
@@ -19,12 +19,14 @@ function finish { rm -f /run/pacman.conf; }
trap finish EXIT
sed '/^Include *= *\/etc\/pacman\.d\/offline\.conf$/s|^|#|' < /etc/pacman.conf > /run/pacman.conf
-# remove triggering symlink and (soft-)reboot override
-rm -f /system-update
-rm -f /run/systemd/system/systemd-reboot.service
+# remove triggering symlink and reboot & poweroff override
+rm --force \
+ /system-update \
+ /run/systemd/system/systemd-poweroff.service \
+ /run/systemd/system/systemd-reboot.service
# install updates
-if [ "$(pacman --sync --print --needed archlinux-keyring | wc -l)" -gt 0 ]; then
+if [ "$(pacman --sync --print --needed archlinux-keyring | wc -l)" -gt 0 ]; then
pacman --sync --noconfirm archlinux-keyring
fi
pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade
@@ -32,8 +34,10 @@ pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade
# clean up package cache
pacman --sync --noconfirm --clean
-# reboot
-if [ -s "/usr/lib/modules/$(uname -r)/pkgbase" ] && systemctl --dry-run soft-reboot 2>/dev/null; then
+# poweroff or (soft-)reboot
+if [ -e '/run/system-update-poweroff' ]; then
+ systemctl poweroff
+elif [ -s "/usr/lib/modules/$(uname -r)/pkgbase" ]; then
systemctl soft-reboot
else
systemctl reboot