summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-10-17 22:39:27 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-10-17 22:39:27 -0300
commiteda9bd59c2d8919f90aa72cf6cffd545d7bd2295 (patch)
tree554120ad087a678423ce2148c2a6126551a05bd5
parent6c95ce9aedf6b1e9353e48f1e52e9989a563980b (diff)
Don't fail if depends are empty
-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[@]}