diff options
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | bin/pacman-offline | 9 | ||||
-rw-r--r-- | config/offline.conf | 6 | ||||
-rwxr-xr-x | systemd/pacman-offline | 7 |
4 files changed, 20 insertions, 3 deletions
@@ -17,6 +17,7 @@ all: README.html install: $(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 hook/99-pacman-offline.hook $(DESTDIR)/usr/share/libalpm/hooks/99-pacman-offline.hook $(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 diff --git a/bin/pacman-offline b/bin/pacman-offline index 534a0a9..0105f54 100755 --- a/bin/pacman-offline +++ b/bin/pacman-offline @@ -37,17 +37,22 @@ if [ -e '/system-update' -a "$(readlink '/system-update')" != '/var/cache/pacman 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 the symlink for now, will be recreated it later rm -f /system-update # check for available updates -if [ "$(pacman --sync --sysupgrade --print | wc -l)" -eq 0 ]; then +if [ "$(pacman --config /run/pacman.conf --sync --sysupgrade --print | wc -l)" -eq 0 ]; then echo "No updates available." exit 0 fi # download packages -pacman --sync --noconfirm --sysupgrade --downloadonly +pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade --downloadonly # enable system update ln -sf /var/cache/pacman/pkg /system-update diff --git a/config/offline.conf b/config/offline.conf new file mode 100644 index 0000000..56f8b76 --- /dev/null +++ b/config/offline.conf @@ -0,0 +1,6 @@ +# Ingore 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 +IgnorePkg = linux-zen linux-zen-headers linux-zen-docs +IgnorePkg = linux-hardened linux-hardened-headers linux-hardened-docs diff --git a/systemd/pacman-offline b/systemd/pacman-offline index 3e9133b..39ed094 100755 --- a/systemd/pacman-offline +++ b/systemd/pacman-offline @@ -7,6 +7,11 @@ if [ "$(readlink '/system-update')" != '/var/cache/pacman/pkg' ]; then exit 0 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 rm -f /system-update @@ -14,7 +19,7 @@ rm -f /system-update if [ "$(pacman --sync --print --needed archlinux-keyring | wc -l)" -gt 0 ]; then pacman --sync --noconfirm archlinux-keyring fi -pacman --sync --noconfirm --sysupgrade +pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade # clean up package cache pacman --sync --noconfirm --clean |