diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | README.md | 17 | ||||
-rwxr-xr-x | bin/pacman-offline | 9 | ||||
-rw-r--r-- | config/offline-include.conf | 2 | ||||
-rwxr-xr-x | systemd/pacman-offline | 17 | ||||
-rw-r--r-- | systemd/pacman-offline-prepare.service | 2 | ||||
-rw-r--r-- | systemd/pacman-offline-prepare.timer | 2 | ||||
-rw-r--r-- | systemd/pacman-offline-reboot.service | 2 | ||||
-rw-r--r-- | systemd/pacman-offline-reboot.timer | 2 | ||||
-rw-r--r-- | systemd/pacman-offline.service | 6 |
10 files changed, 42 insertions, 20 deletions
@@ -7,7 +7,7 @@ SED := sed # this is just a fallback in case you do not # use git but downloaded a release tarball... -VERSION := 0.3.2 +VERSION := 0.3.5 all: README.html @@ -20,6 +20,7 @@ install: install-bin install-doc install-bin: $(INSTALL) -D -m0755 bin/pacman-offline $(DESTDIR)/usr/bin/pacman-offline $(INSTALL) -D -m0644 config/offline.conf $(DESTDIR)/etc/pacman.d/offline.conf + $(INSTALL) -D -m0644 config/offline-include.conf $(DESTDIR)/etc/pacman.d/offline-include.conf $(INSTALL) -D -m0644 hook/99-pacman-offline.hook $(DESTDIR)/usr/share/libalpm/hooks/99-pacman-offline.hook $(INSTALL) -D -m0644 polkit/pacman-offline.rules $(DESTDIR)/usr/share/polkit-1/rules.d/pacman-offline.rules $(INSTALL) -D -m0644 systemd/pacman-offline.service $(DESTDIR)/usr/lib/systemd/system/pacman-offline.service @@ -70,16 +70,21 @@ This will trigger at night, if updates are pending and prepared. Configuration ------------- -A sinppet for inclusion in `/etc/pacman.conf` is shipped. To make use of -it add this line: +Two sinppets for inclusion in `/etc/pacman.conf` are shipped. To make use of +them add these line: Include = /etc/pacman.d/offline.conf + #Include = /etc/pacman.d/offline-include.conf -It will cause `pacman` to ignore linux packages and prevent breaking module -loading. These packages are not ignored on offline update. +The first one will cause `pacman` to ignore linux packages and prevent +breaking module loading and hibernation. These packages are not ignored +on offline update. -Modify `/etc/pacman.d/offline.conf` to your needs by changing or adding -packages. +The second one has the opposite effect, it is included on offline action +only. + +Modify `/etc/pacman.d/offline.conf` and `/etc/pacman.d/offline-include.conf` +to your needs by changing or adding packages, or adding new directives. License and warranty -------------------- diff --git a/bin/pacman-offline b/bin/pacman-offline index cb46cb4..28d6a2c 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 @@ -135,7 +138,7 @@ fi # (soft-)reboot if requested if [ ${REBOOT} -eq 1 ]; then echo "Soft-rebooting for update." - systemctl soft-reboot + exec 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 diff --git a/config/offline-include.conf b/config/offline-include.conf new file mode 100644 index 0000000..879919e --- /dev/null +++ b/config/offline-include.conf @@ -0,0 +1,2 @@ +# Add this file as commented include, and it will be included on +# offline action. 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 diff --git a/systemd/pacman-offline-prepare.service b/systemd/pacman-offline-prepare.service index c9b5ba5..3979f0b 100644 --- a/systemd/pacman-offline-prepare.service +++ b/systemd/pacman-offline-prepare.service @@ -1,4 +1,4 @@ -# (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 diff --git a/systemd/pacman-offline-prepare.timer b/systemd/pacman-offline-prepare.timer index 598b387..a0b537c 100644 --- a/systemd/pacman-offline-prepare.timer +++ b/systemd/pacman-offline-prepare.timer @@ -1,4 +1,4 @@ -# (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 diff --git a/systemd/pacman-offline-reboot.service b/systemd/pacman-offline-reboot.service index c131d70..20a6e47 100644 --- a/systemd/pacman-offline-reboot.service +++ b/systemd/pacman-offline-reboot.service @@ -1,4 +1,4 @@ -# (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 diff --git a/systemd/pacman-offline-reboot.timer b/systemd/pacman-offline-reboot.timer index b6852a9..cf23ce5 100644 --- a/systemd/pacman-offline-reboot.timer +++ b/systemd/pacman-offline-reboot.timer @@ -1,4 +1,4 @@ -# (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 diff --git a/systemd/pacman-offline.service b/systemd/pacman-offline.service index 516acae..bde311f 100644 --- a/systemd/pacman-offline.service +++ b/systemd/pacman-offline.service @@ -1,4 +1,4 @@ -# (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 @@ -16,8 +16,12 @@ OnFailure=reboot.target [Service] Type=oneshot +# Pretty print to tty... StandardOutput=tty StandardError=tty +# ... or use this for debugging - less pretty, but with output in journal. +#StandardOutput=journal+console +#StandardError=journal+console ExecStartPre=-/usr/bin/plymouth change-mode --updates ExecStartPre=-/usr/bin/plymouth system-update --progress=20 ExecStart=/usr/lib/systemd/scripts/pacman-offline |