summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-11-05 16:30:55 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-11-05 16:30:55 -0300
commit83dd1498e580510023b63611bb25feedd3699b8c (patch)
tree9cf9f1088149eb1ddd03826482a155638e110be0
parent61ca876072f8e7a5a6ab90974db895c57434ae9c (diff)
Make librechroot use chcleanup
-rwxr-xr-xlibrechroot34
1 files changed, 2 insertions, 32 deletions
diff --git a/librechroot b/librechroot
index 9e292f5..b4766e6 100755
--- a/librechroot
+++ b/librechroot
@@ -44,39 +44,9 @@ function usage {
}
function clean_chroot { # Clean packages with pacman
- msg "Cleaning chroot: ${CHROOTDIR}/${CHROOTNAME}"
- cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/cleansystem"
- (cat <<EOF
-#!/bin/bash
-export LANG=C
-
-count='0'
-
-while [ "\$count" -lt "3" ]; do
-
- pkgs=(\$(comm -23 <(pacman -Qq | sort) <(sort /cleansystem)))
-
- if [ \${#pkgs[@]} -gt 0 ]; then
- pacman --noconfirm -Rcs \${pkgs[@]}
- else
- echo "clean"
- exit 0
- fi
-
- declare -i "count=\$count + 1"
-
-done
-
-echo "Cleaning failed: please report error"
-
-EOF
- ) > "${CHROOTDIR}/${CHROOTNAME}/clean"
-
- chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean"
- mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
+ cp -a "$(dirname $0)/chcleanup" "${CHROOTDIR}/${CHROOTNAME}/clean"
- rm "${CHROOTDIR}/${CHROOTNAME}/clean"
- rm "${CHROOTDIR}/${CHROOTNAME}/cleansystem"
+ mkarchroot -r "/clean"
}
function clean_repo {