aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pacman-offline40
1 files changed, 24 insertions, 16 deletions
diff --git a/bin/pacman-offline b/bin/pacman-offline
index cb46cb4..181aa74 100755
--- a/bin/pacman-offline
+++ b/bin/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
@@ -107,7 +107,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 the symlink for now, will be recreated it later
rm -f /system-update
@@ -129,26 +132,29 @@ pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade --downloadonly
# enable system update
ln -sf /var/cache/pacman/pkg /system-update
if [ ${POWEROFF} -eq 1 ]; then
- touch /run/system-update-poweroff
+ touch /run/pacman-offline-poweroff
fi
-# (soft-)reboot if requested
-if [ ${REBOOT} -eq 1 ]; then
- echo "Soft-rebooting for update."
- systemctl soft-reboot
-else
- # force a soft-reboot on (manual) reboot ...
- ln -sf ../../../usr/lib/systemd/system/systemd-soft-reboot.service /run/systemd/system/systemd-reboot.service
+# force a soft-reboot on (manual) reboot ...
+ln -sf ../../../usr/lib/systemd/system/systemd-soft-reboot.service \
+ /run/systemd/system/systemd-reboot.service
- # ... and also on poweroff, but prepare poweroff
- cp /usr/lib/systemd/system/systemd-soft-reboot.service /run/systemd/system/systemd-poweroff.service
- cat >> /run/systemd/system/systemd-poweroff.service <<-EOF
+# ... and also on poweroff, but prepare poweroff
+cp /usr/lib/systemd/system/systemd-soft-reboot.service \
+ /run/systemd/system/systemd-poweroff.service
+cat >> /run/systemd/system/systemd-poweroff.service <<-EOF
[Service]
- ExecStart=/usr/bin/touch /run/system-update-poweroff
+ ExecStart=/usr/bin/touch /run/pacman-offline-poweroff
EOF
- systemctl daemon-reload
+# reload for service changes
+systemctl daemon-reload
+
+# (soft-)reboot if requested
+if [ ${REBOOT} -eq 1 ]; then
+ echo 'Rebooting for update.'
+ exec systemctl reboot
fi
# start timer if requested
@@ -157,4 +163,6 @@ if [ ${TIMER} -eq 1 ]; then
fi
# show the timer (if active)
-systemctl --quiet --no-pager list-timers pacman-offline-prepare.timer pacman-offline-reboot.timer
+systemctl --quiet --no-pager list-timers \
+ pacman-offline-prepare.timer \
+ pacman-offline-reboot.timer