diff options
| -rw-r--r-- | Makefile | 15 | ||||
| -rw-r--r-- | README.md | 72 | ||||
| -rwxr-xr-x | bin/pacman-offline | 121 | ||||
| -rw-r--r-- | config/offline-include.conf | 2 | ||||
| -rw-r--r-- | config/offline.conf | 2 | ||||
| -rw-r--r-- | desktop/pacman-offline.desktop | 11 | ||||
| -rw-r--r-- | hook/99-pacman-offline.hook | 6 | ||||
| -rw-r--r-- | polkit/pacman-offline.rules | 11 | ||||
| -rwxr-xr-x | systemd/pacman-offline | 57 | ||||
| -rw-r--r-- | systemd/pacman-offline-done-poweroff.service | 22 | ||||
| -rw-r--r-- | systemd/pacman-offline-done-reboot.service | 22 | ||||
| -rw-r--r-- | systemd/pacman-offline-prepare.service | 6 | ||||
| -rw-r--r-- | systemd/pacman-offline-prepare.timer | 3 | ||||
| -rw-r--r-- | systemd/pacman-offline-reboot.service | 14 | ||||
| -rw-r--r-- | systemd/pacman-offline-reboot.timer | 4 | ||||
| -rw-r--r-- | systemd/pacman-offline.service | 14 | 
16 files changed, 302 insertions, 80 deletions
| @@ -7,7 +7,8 @@ SED	:= sed  # this is just a fallback in case you do not  # use git but downloaded a release tarball... -VERSION := 0.2.3 +DISTVER := 0.3.9 +VERSION ?= $(shell git describe --long 2>/dev/null || echo $(DISTVER))  all: README.html @@ -20,12 +21,16 @@ 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 desktop/pacman-offline.desktop $(DESTDIR)/usr/share/applications/pacman-offline.desktop  	$(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  	$(INSTALL) -D -m0755 systemd/pacman-offline $(DESTDIR)/usr/lib/systemd/scripts/pacman-offline +	$(INSTALL) -D -m0644 systemd/pacman-offline-done-poweroff.service $(DESTDIR)/usr/lib/systemd/system/pacman-offline-done-poweroff.service +	$(INSTALL) -D -m0644 systemd/pacman-offline-done-reboot.service $(DESTDIR)/usr/lib/systemd/system/pacman-offline-done-reboot.service  	$(INSTALL) -D -m0644 systemd/pacman-offline-prepare.service $(DESTDIR)/usr/lib/systemd/system/pacman-offline-prepare.service  	$(INSTALL) -D -m0644 systemd/pacman-offline-prepare.timer $(DESTDIR)/usr/lib/systemd/system/pacman-offline-prepare.timer -	$(INSTALL) -D -m0644 systemd/pacman-offline-reboot.service $(DESTDIR)/usr/lib/systemd/system/pacman-offline-reboot.service  	$(INSTALL) -D -m0644 systemd/pacman-offline-reboot.timer $(DESTDIR)/usr/lib/systemd/system/pacman-offline-reboot.timer  	$(INSTALL) -d -m0755 $(DESTDIR)/usr/lib/systemd/system/system-update.target.wants/  	$(LN) -s ../pacman-offline.service $(DESTDIR)/usr/lib/systemd/system/system-update.target.wants/pacman-offline.service @@ -38,6 +43,6 @@ clean:  	$(RM) -f README.html  release: -	git archive --format=tar.xz --prefix=pacman-offline-$(VERSION)/ $(VERSION) > pacman-offline-$(VERSION).tar.xz -	gpg --armor --detach-sign --comment pacman-offline-$(VERSION).tar.xz pacman-offline-$(VERSION).tar.xz -	git notes --ref=refs/notes/signatures/tar add -C $$(git archive --format=tar --prefix=pacman-offline-$(VERSION)/ $(VERSION) | gpg --armor --detach-sign --comment pacman-offline-$(VERSION).tar | git hash-object -w --stdin) $(VERSION) +	git archive --format=tar.xz --prefix=pacman-offline-$(DISTVER)/ $(DISTVER) > pacman-offline-$(DISTVER).tar.xz +	gpg --armor --detach-sign --comment pacman-offline-$(DISTVER).tar.xz pacman-offline-$(DISTVER).tar.xz +	git notes --ref=refs/notes/signatures/tar add -C $$(git archive --format=tar --prefix=pacman-offline-$(DISTVER)/ $(DISTVER) | gpg --armor --detach-sign --comment pacman-offline-$(DISTVER).tar | git hash-object -w --stdin) $(DISTVER) @@ -1,23 +1,35 @@  pacman-offline  ============== +[](https://github.com/eworm-de/pacman-offline/stargazers) +[](https://github.com/eworm-de/pacman-offline/network) +[](https://github.com/eworm-de/pacman-offline/watchers) +  **Run offline system update with pacman.**  The offline system update with pacman is achieved by integrating into -[offline updates in systemd](https://www.freedesktop.org/software/systemd/man/systemd.offline-updates.html#/etc/system-update). +[offline updates in systemd ↗️](https://www.freedesktop.org/software/systemd/man/systemd.offline-updates.html).  In fact only two scripts and a number of systemd unit files are used to  glue `systemd` and `pacman`. +*Use at your own risk*, pay attention to +[license and warranty](#license-and-warranty), and +[disclaimer on external links](#disclaimer-on-external-links)! +  Requirements  ------------  There are the runtime dependencies: -* [pacman](https://archlinux.org/pacman/) -* [systemd](https://www.github.com/systemd/systemd) +* [pacman ↗️](https://archlinux.org/pacman/) +* [systemd ↗️](https://www.github.com/systemd/systemd) + +And there's an optional dependency to support elevating privileges: + +* [polkit ↗️](https://github.com/polkit-org/polkit)  Optional basic support for -[plymouth](https://www.freedesktop.org/wiki/Software/Plymouth/) is +[plymouth ↗️](https://www.freedesktop.org/wiki/Software/Plymouth/) is  integrated.  Usage @@ -26,13 +38,25 @@ Usage  A single command `pacman-offline` is used to prepare the offline update.  It accepts some arguments: +* *-a*: abort pending system-update  * *-c*: clean before download  * *-f*: force if other system-update is pending  * *-h*: show help +* *-p*: reboot, install and poweroff immediately  * *-r*: reboot and install immediately  * *-t*: start timer for nightly reboot  * *-y*: update sync databases +### Elevating privileges + +The privileges are elevated automatically if `polkit` is installed. This works +with no authentication if your user is member of the group `wheel`. To add your +user to that group run: + +    usermod --append --groups wheel user + +If your user is not member of that group you will be asked for a password. +  ### Timer for preparation  You can enable a timer to prepare the offline update automatically. @@ -51,19 +75,29 @@ You can enable a timer for nightly reboot:  This will trigger at night, if updates are pending and prepared. +### Desktop environment + +A *desktop file* is installed to allow preparing from a desktop +environment. Have a look at your application menu... +  Configuration  ------------- -A sinppet for inclusion in `/etc/pacman.conf` is shipped. To make use of -it add this line: +Two snippets 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  -------------------- @@ -78,6 +112,21 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  [GNU General Public License](COPYING.md) for more details. +Disclaimer on external links +---------------------------- + +Our website contains links to the websites of third parties ("external +links"). As the content of these websites is not under our control, we +cannot assume any liability for such external content. In all cases, the +provider of information of the linked websites is liable for the content +and accuracy of the information provided. At the point in time when the +links were placed, no infringements of the law were recognisable to us. +As soon as an infringement of the law becomes known to us, we will +immediately remove the link in question. + +> 💡️ **Hint**: All external links are marked with an arrow pointing +> diagonally in an up-right (or north-east) direction (↗️). +  ### Upstream  URL: @@ -86,3 +135,6 @@ URL:  Mirror:  [eworm.de](https://git.eworm.de/cgit.cgi/pacman-offline/)  [GitLab.com](https://gitlab.com/eworm-de/pacman-offline#pacman-offline) + +--- +[⬆️ Go back to top](#top) diff --git a/bin/pacman-offline b/bin/pacman-offline index acc8646..73723af 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 @@ -10,22 +10,70 @@  set -e  function help() { -	echo "usage: ${0} [OPTIONS]" -	echo -	echo ' -f  force if other system-update is pending' -	echo ' -c  clean before download' -	echo ' -h  this help' -	echo ' -r  reboot and install immediately' -	echo ' -t  start timer for nightly reboot' -	echo ' -y  update sync databases' +	cat <<-EOM +	usage: ${0} [OPTIONS] + +	 -a  abort pending system-update +	 -c  clean before download +	 -f  force if other system-update is pending +	 -h  this help +	 -p  reboot, install and poweroff immediately +	 -r  reboot and install immediately +	 -t  start timer for nightly reboot +	 -y  update sync databases +	EOM  }  CLEAN=0 +POWEROFF=0  REBOOT=0  TIMER=0 -while getopts 'cfhrty' opt; do +while getopts 'acfhprty' opt; do  	case ${opt} in +		h) +			help +			exit 0 +			;; +		a|c|f|p|r|t|y) +			;; +		*) +			exit 1 +			;; +	esac +done + +if systemd-detect-virt --chroot 2>/dev/null; then +	echo 'Running in chroot, skipping.' >&2 +	exit 0 +fi + +if [ ! -d /run/systemd/system ]; then +	echo 'Current root is not booted, skipping.' >&2 +	exit 0 +fi + +if [ "${UID}" -ne 0 ]; then +	if command -v pkexec >/dev/null; then +		echo 'Missing privileges, trying to elevate.' >&2 +		exec pkexec "${0}" "${@}" +	fi + +	echo "You need elevated privileges. Please run as user 'root'!" >&2 +	exit 1 +fi + +OPTIND=1 +while getopts 'acfhprty' opt; do +	case ${opt} in +		a) +			rm --force \ +				/system-update \ +				/run/systemd/system/systemd-poweroff.service \ +				/run/systemd/system/systemd-reboot.service +			systemctl daemon-reload +			exit 0 +			;;  		c)  			if pacman-conf 'CleanMethod' | grep -q 'KeepCurrent'; then  				CLEAN=1 @@ -36,9 +84,9 @@ while getopts 'cfhrty' opt; do  		f)  			rm -f /system-update  			;; -		h) -			help -			exit 0 +		p) +			POWEROFF=1 +			REBOOT=1  			;;  		r)  			REBOOT=1 @@ -61,14 +109,17 @@ 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  # check for available updates  if [ "$(pacman --config /run/pacman.conf --sync --sysupgrade --print | wc -l)" -eq 0 ]; then -	echo "No updates available." +	echo 'No updates available.'  	exit 0  fi @@ -82,26 +133,40 @@ 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/pacman-offline-poweroff +fi + +# 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 -# reboot if requested +	[Service] +	ExecStart=/usr/bin/touch /run/pacman-offline-poweroff +	EOF + +# reload for service changes +systemctl daemon-reload + +# (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 -# force a soft-reboot on (manual) reboot -elif [ -e /usr/lib/systemd/system/systemd-soft-reboot.service ]; then -	ln -sf ../../../usr/lib/systemd/system/systemd-soft-reboot.service /run/systemd/system/systemd-reboot.service -	systemctl daemon-reload +	echo 'Rebooting for update.' +	exec systemctl reboot  fi +echo 'Updates will be installed on next reboot.' +  # start timer if requested  if [ ${TIMER} -eq 1 ]; then  	systemctl start pacman-offline-reboot.timer  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 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/config/offline.conf b/config/offline.conf index 56f8b76..97e78e3 100644 --- a/config/offline.conf +++ b/config/offline.conf @@ -1,4 +1,4 @@ -# Ingore linux packages and prevent breaking module loading. The include of +# Ignore linux packages and prevent breaking module loading. The include of  # this configuration file is removed on offline action.  IgnorePkg = linux linux-headers linux-docs  IgnorePkg = linux-lts linux-lts-headers linux-lts-docs diff --git a/desktop/pacman-offline.desktop b/desktop/pacman-offline.desktop new file mode 100644 index 0000000..2228c55 --- /dev/null +++ b/desktop/pacman-offline.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=pacman-offline +GenericName=Offline System Update +Comment=Download and prepare Offline System Update +Icon=system-software-update +Exec=sh -c 'pacman-offline -cy; echo Press ENTER to close.; read' +Terminal=true +Categories=System;PackageManager +Keywords=system;PackageManager diff --git a/hook/99-pacman-offline.hook b/hook/99-pacman-offline.hook index 0538072..12da360 100644 --- a/hook/99-pacman-offline.hook +++ b/hook/99-pacman-offline.hook @@ -6,6 +6,6 @@ Type = Package  Target = *  [Action] -Description = Disabling scheduled pacman offline update... -When = PostTransaction -Exec = /bin/sh -c 'rm -fv /system-update /run/systemd/system/systemd-reboot.service && systemctl daemon-reload' +Description = Aborting pending pacman offline system-update... +When = PreTransaction +Exec = /usr/bin/pacman-offline -a diff --git a/polkit/pacman-offline.rules b/polkit/pacman-offline.rules new file mode 100644 index 0000000..82cc5c2 --- /dev/null +++ b/polkit/pacman-offline.rules @@ -0,0 +1,11 @@ +/* Allow members of the wheel group to run pacman-offline */ + +polkit.addRule( +	function(action, subject) { +		if (action.id == "org.freedesktop.policykit.exec" && +		    action.lookup("program") == "/usr/bin/pacman-offline" && +		    subject.isInGroup("wheel")) { +			return polkit.Result.YES; +		} +	} +); diff --git a/systemd/pacman-offline b/systemd/pacman-offline index 9471bfc..f0f1c12 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 @@ -14,27 +14,60 @@ if [ "$(readlink '/system-update')" != '/var/cache/pacman/pkg' ]; then  	exit 0  fi +# force the proper action on failure, ... +if [ -e '/run/pacman-offline-poweroff' ]; then +	ln -sf ../../../usr/lib/systemd/system/poweroff.target \ +		/run/systemd/system/pacman-offline-failure.target +else +	ln -sf ../../../usr/lib/systemd/system/reboot.target \ +		/run/systemd/system/pacman-offline-failure.target +fi +# ... remove triggering symlink and reboot & poweroff override, ... +rm --force \ +	/system-update \ +	/run/systemd/system/systemd-poweroff.service \ +	/run/systemd/system/systemd-reboot.service +# ... and reload +systemctl daemon-reload + +# check battery level +if ! /usr/lib/systemd/systemd-battery-check; then +	echo 'Battery level is too low!' >&2 +	exit 1 +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 - -# remove triggering symlink and (soft-)reboot override -rm -f /system-update -rm -f /run/systemd/system/systemd-reboot.service +sed \ +	-e '/^Include *= *\/etc\/pacman\.d\/offline\.conf$/s|^|#|' \ +	-e '/^#Include *= *\/etc\/pacman\.d\/offline-include\.conf$/s|^#||' \ +	< /etc/pacman.conf > /run/pacman.conf  # 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 +# clean up config file, drop trap +rm -f /run/pacman.conf +trap - EXIT +  # 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 -	systemctl soft-reboot -else -	systemctl reboot +# sync the storage +sync + +# prepare for soft-reboot via override when applicable +if [ ! -e '/run/pacman-offline-poweroff' -a \ +     -s "/usr/lib/modules/$(uname -r)/pkgbase" ]; then +	ln -sf ../../../usr/lib/systemd/system/systemd-soft-reboot.service \ +		/run/systemd/system/systemd-reboot.service +	systemctl daemon-reload  fi + +# All done, just touch a status file and exit successfully! +# (Soft-)Reboot or Poweroff is done by specific units. +touch /run/pacman-offline-done diff --git a/systemd/pacman-offline-done-poweroff.service b/systemd/pacman-offline-done-poweroff.service new file mode 100644 index 0000000..441daa9 --- /dev/null +++ b/systemd/pacman-offline-done-poweroff.service @@ -0,0 +1,22 @@ +# (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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + + +[Unit] +Description=Offline system update with pacman - Poweroff +Documentation=https://pacman-offline.eworm.de/ +After=pacman-offline.service +DefaultDependencies=no +Conflicts=shutdown.target +Before=shutdown.target system-update.target +ConditionPathExists=/run/pacman-offline-done +ConditionPathExists=/run/pacman-offline-poweroff +SuccessAction=poweroff + +[Service] +Type=oneshot +ExecStart=/usr/bin/rm --force /run/pacman-offline-done /run/pacman-offline-poweroff diff --git a/systemd/pacman-offline-done-reboot.service b/systemd/pacman-offline-done-reboot.service new file mode 100644 index 0000000..b4e7b48 --- /dev/null +++ b/systemd/pacman-offline-done-reboot.service @@ -0,0 +1,22 @@ +# (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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + + +[Unit] +Description=Offline system update with pacman - Reboot +Documentation=https://pacman-offline.eworm.de/ +After=pacman-offline.service +DefaultDependencies=no +Conflicts=shutdown.target +Before=shutdown.target system-update.target +ConditionPathExists=/run/pacman-offline-done +ConditionPathExists=!/run/pacman-offline-poweroff +SuccessAction=reboot + +[Service] +Type=oneshot +ExecStart=/usr/bin/rm --force /run/pacman-offline-done /run/systemd/system/systemd-reboot.service diff --git a/systemd/pacman-offline-prepare.service b/systemd/pacman-offline-prepare.service index c9b5ba5..deb746b 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 @@ -7,7 +7,11 @@  [Unit]  Description=Prepare pacman offline system-update +Documentation=https://pacman-offline.eworm.de/  ConditionPathExists=!/var/lib/pacman/db.lck +# Synchronizing databases needs network, see https://systemd.io/NETWORK_ONLINE/ +After=network-online.target +Wants=network-online.target  [Service]  Type=oneshot diff --git a/systemd/pacman-offline-prepare.timer b/systemd/pacman-offline-prepare.timer index 598b387..c4a2cdf 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 @@ -7,6 +7,7 @@  [Unit]  Description=Prepare pacman offline system-update +Documentation=https://pacman-offline.eworm.de/  [Timer]  OnBootSec=5min diff --git a/systemd/pacman-offline-reboot.service b/systemd/pacman-offline-reboot.service deleted file mode 100644 index 26dca94..0000000 --- a/systemd/pacman-offline-reboot.service +++ /dev/null @@ -1,14 +0,0 @@ -# (C) 2017-2024 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -[Unit] -Description=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" diff --git a/systemd/pacman-offline-reboot.timer b/systemd/pacman-offline-reboot.timer index b6852a9..024c9da 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 @@ -7,10 +7,12 @@  [Unit]  Description=Reboot for pacman offline system-update +Documentation=https://pacman-offline.eworm.de/  [Timer]  OnCalendar=03:00:00  RandomizedDelaySec=2hours +Unit=systemd-reboot.service  [Install]  WantedBy=timers.target diff --git a/systemd/pacman-offline.service b/systemd/pacman-offline.service index 516acae..9ce6639 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 @@ -7,17 +7,23 @@  [Unit]  Description=Offline system update with pacman +Documentation=https://pacman-offline.eworm.de/  ConditionPathIsSymbolicLink=/system-update  DefaultDependencies=false  Requires=sysinit.target dbus.socket -After=sysinit.target dbus.socket -Before=shutdown.target system-update.target -OnFailure=reboot.target +Wants=pacman-offline-done-poweroff.service pacman-offline-done-reboot.service +After=sysinit.target system-update-pre.target dbus.socket +Before=pacman-offline-done-poweroff.service pacman-offline-done-reboot.service system-update.target +OnFailure=pacman-offline-failure.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 |