From 65c8e0638b90d619ea8450f37af832af9b657fd1 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 28 Jan 2020 11:16:55 +0100 Subject: act on specific packages on offline action only This adds a configuration file /etc/pacman.d/offline.conf that can be included to global pacman configuration file /etc/pacman.conf. By default it contains configuration to ignore linux packages. On offline action this include is removed, allowing to update linux packages on offline action only. This prevents from breaking module loading in a running system. --- bin/pacman-offline | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3-70-g09d2