summaryrefslogtreecommitdiff
path: root/chcleanup
diff options
context:
space:
mode:
Diffstat (limited to 'chcleanup')
-rwxr-xr-xchcleanup19
1 files changed, 12 insertions, 7 deletions
diff --git a/chcleanup b/chcleanup
index 9a27d49..5fdbc58 100755
--- a/chcleanup
+++ b/chcleanup
@@ -25,14 +25,19 @@ touch ${cleanup_log}
if [ -f PKGBUILD ]; then
source PKGBUILD || true
+ check=(${depends[@]} ${makedepends[@]} ${checkdepends[@]})
+
+ if [ ${#check[@]} -ne 0 ]; then
+
# Update the cleansystem database
- sudo pacman -b "${BD:-/var/lib/libretools/clean}" -Sy
+ sudo pacman -b "${BD:-/var/lib/libretools/clean}" -Sy
# Get the full list of packages needed by dependencies
- sudo pacman -b "${BD:-/var/lib/libretools/clean}" \
- -Sp \
- --print-format "%n" \
- ${depends[@]} ${makedepends[@]} ${checkdepends[@]} \
- >${cleanup_log}
+ sudo pacman -b "${BD:-/var/lib/libretools/clean}" \
+ -Sp \
+ --print-format "%n" \
+ ${check[@]} \
+ >${cleanup_log}
+ fi
fi
# Diff installed packages against a clean chroot and needed packages,
@@ -43,7 +48,7 @@ packages=($(comm -23 <(pacman -Qq | sort) \
[ ${#packages[@]} -eq 0 ] && exit 0
-msg2 "Removing ${#packages[@]} packages: ${packages[@]}"
+msg2 "Removing %d packages: %s" ${#packages[@]} "${packages[@]}"
# Only remove leftovers, -Rcs removes too much
sudo pacman --noconfirm -Rn ${packages[@]}