From 7480f12e05220b14e331c7ba8cfaf7be6b6b324d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 25 Jun 2023 11:23:51 +0200 Subject: add option to clean cache --- bin/pacman-offline | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/pacman-offline b/bin/pacman-offline index 1a7c794..1573eb8 100755 --- a/bin/pacman-offline +++ b/bin/pacman-offline @@ -6,17 +6,22 @@ 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' } +CLEAN=0 REBOOT=0 TIMER=0 -while getopts 'fhrty' opt; do +while getopts 'cfhrty' opt; do case ${opt} in + c) + CLEAN=1 + ;; f) rm -f /system-update ;; @@ -56,6 +61,11 @@ if [ "$(pacman --config /run/pacman.conf --sync --sysupgrade --print | wc -l)" - exit 0 fi +# clean cache +if [ ${CLEAN} -eq 1 ]; then + pacman --sync --noconfirm --clean +fi + # download packages pacman --config /run/pacman.conf --sync --noconfirm --sysupgrade --downloadonly -- cgit v1.2.3-70-g09d2