summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-05-27 19:00:35 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-05-29 09:23:49 +0200
commit3686c619c00b04e4104565532bbad2e76c8fab2c (patch)
tree236d293176d07b1d579409a8bcf8e67894cd8952
parent406b5748d77aec618dadc4bb96b19dac8a6bef55 (diff)
downloadpacman-offline-3686c619c00b04e4104565532bbad2e76c8fab2c.tar.gz
pacman-offline-3686c619c00b04e4104565532bbad2e76c8fab2c.tar.zst
make soft-reboot functionality mandatory
This makes sure /run is preserved, and allows us to implement some more functionality later on.
-rwxr-xr-xbin/pacman-offline13
-rwxr-xr-xsystemd/pacman-offline4
-rw-r--r--systemd/pacman-offline-reboot.service4
3 files changed, 8 insertions, 13 deletions
diff --git a/bin/pacman-offline b/bin/pacman-offline
index a8474e2..7ca2d25 100755
--- a/bin/pacman-offline
+++ b/bin/pacman-offline
@@ -99,17 +99,12 @@ pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade --downloadonly
# enable system update
ln -sf /var/cache/pacman/pkg /system-update
-# reboot if requested
+# (soft-)reboot if requested
if [ ${REBOOT} -eq 1 ]; then
- if systemctl --dry-run soft-reboot 2>/dev/null; then
- echo "Soft-rebooting for update."
- systemctl soft-reboot
- else
- echo "Rebooting for update."
- systemctl reboot
- fi
+ echo "Soft-rebooting for update."
+ systemctl soft-reboot
# force a soft-reboot on (manual) reboot
-elif [ -e /usr/lib/systemd/system/systemd-soft-reboot.service ]; then
+else
ln -sf ../../../usr/lib/systemd/system/systemd-soft-reboot.service /run/systemd/system/systemd-reboot.service
systemctl daemon-reload
fi
diff --git a/systemd/pacman-offline b/systemd/pacman-offline
index 973dc01..bacf696 100755
--- a/systemd/pacman-offline
+++ b/systemd/pacman-offline
@@ -32,8 +32,8 @@ 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
+# (soft-)reboot
+if [ -s "/usr/lib/modules/$(uname -r)/pkgbase" ]; then
systemctl soft-reboot
else
systemctl reboot
diff --git a/systemd/pacman-offline-reboot.service b/systemd/pacman-offline-reboot.service
index 26dca94..c131d70 100644
--- a/systemd/pacman-offline-reboot.service
+++ b/systemd/pacman-offline-reboot.service
@@ -6,9 +6,9 @@
# (at your option) any later version.
[Unit]
-Description=Reboot for pacman offline system-update
+Description=Soft-reboot for pacman offline system-update
ConditionPathExists=/system-update
[Service]
Type=oneshot
-ExecStart=/bin/sh -c "if systemctl --dry-run soft-reboot 2>/dev/null; then systemctl soft-reboot; else systemctl reboot; fi"
+ExecStart=/usr/bin/systemctl soft-reboot