aboutsummaryrefslogtreecommitdiffstats
path: root/systemd/pacman-offline
diff options
context:
space:
mode:
Diffstat (limited to 'systemd/pacman-offline')
-rwxr-xr-xsystemd/pacman-offline17
1 files changed, 12 insertions, 5 deletions
diff --git a/systemd/pacman-offline b/systemd/pacman-offline
index 9bae2ee..ed6a689 100755
--- a/systemd/pacman-offline
+++ b/systemd/pacman-offline
@@ -1,6 +1,6 @@
#!/bin/sh
-# (C) 2017-2024 by Christian Hesse <mail@eworm.de>
+# (C) 2017-2025 by Christian Hesse <mail@eworm.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,10 @@ fi
# exclude /etc/pacman.d/offline.conf
function finish { rm -f /run/pacman.conf; }
trap finish EXIT
-sed '/^Include *= *\/etc\/pacman\.d\/offline\.conf$/s|^|#|' < /etc/pacman.conf > /run/pacman.conf
+sed \
+ -e '/^Include *= *\/etc\/pacman\.d\/offline\.conf$/s|^|#|' \
+ -e '/^#Include *= *\/etc\/pacman\.d\/offline-include\.conf$/s|^#||' \
+ < /etc/pacman.conf > /run/pacman.conf
# remove triggering symlink and reboot & poweroff override
rm --force \
@@ -31,14 +34,18 @@ if [ "$(pacman --sync --print --needed archlinux-keyring | wc -l)" -gt 0 ]; then
fi
pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade
+# clean up config file, drop trap
+rm -f /run/pacman.conf
+trap - EXIT
+
# clean up package cache
pacman --sync --noconfirm --clean
# poweroff or (soft-)reboot
if [ -e '/run/system-update-poweroff' ]; then
- systemctl poweroff
+ exec systemctl poweroff
elif [ -s "/usr/lib/modules/$(uname -r)/pkgbase" ]; then
- systemctl soft-reboot
+ exec systemctl soft-reboot
else
- systemctl reboot
+ exec systemctl reboot
fi