summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-01-28 11:16:55 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-01-28 11:33:01 +0100
commit65c8e0638b90d619ea8450f37af832af9b657fd1 (patch)
tree5e55944034fa0aca3d89fab12076820a09e616e4 /bin
parent54bed85724efa95898610fed877d2eedbe7c23c7 (diff)
downloadpacman-offline-65c8e0638b90d619ea8450f37af832af9b657fd1.tar.gz
pacman-offline-65c8e0638b90d619ea8450f37af832af9b657fd1.tar.zst
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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pacman-offline9
1 files changed, 7 insertions, 2 deletions
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