summaryrefslogtreecommitdiff
path: root/libremakepkg
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-06-26 18:07:53 -0500
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-06-26 18:07:53 -0500
commit69335b6ff0342a2d3201158b9a18010c57cbcf26 (patch)
treee3021740a7a12b5257083a818f86c644b448668e /libremakepkg
parent405c965328f24b7db87aa45f8cc2f513e57d20e5 (diff)
libremakepkg cleans better
rePKGBUILD.proto finds links and delete them
Diffstat (limited to 'libremakepkg')
-rwxr-xr-xlibremakepkg42
1 files changed, 27 insertions, 15 deletions
diff --git a/libremakepkg b/libremakepkg
index babed47..e446833 100755
--- a/libremakepkg
+++ b/libremakepkg
@@ -51,6 +51,32 @@ function buildenv {
done
}
+# Clean packages with pacman
+function clean_chroot {
+ plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/"
+ cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem"
+ (cat <<EOF
+#!/bin/bash
+export LANG=C
+
+clean='false'
+
+while [ "\$clean" = 'false' ]; do
+
+ pkgs=(\$(comm -23 <(pacman -Qq | sort) <(sort /root/cleansystem)))
+
+ if [ \${#pkgs[@]} -gt 0 ]; then
+ pacman --noconfirm -Rcs \${pkgs[@]}
+ else
+ clean="true"
+ echo "clean"
+ fi
+done
+EOF
+ ) > "${CHROOTDIR}/${CHROOTNAME}/clean"
+ mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
+}
+
# End inmediately but print a useful message
trap_exit() {
@@ -120,21 +146,7 @@ fi
if [ "${CLEAN_FIRST}" = y ]; then
msg "Cleaning"
- plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/"
- cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem"
- (cat <<EOF
-#!/bin/bash
-export LANG=C
-
-pkgs=(\$(comm -23 <(pacman -Qq | sort) <(sort /root/cleansystem)))
-
-[ \${#pkgs[@]} -gt 0 ] && pacman --noconfirm -Rcs \${pkgs} || echo "done"
-
-EOF
- ) > "${CHROOTDIR}/${CHROOTNAME}/clean"
- echo -n "doing cleanup..."
- mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
-
+ clean_chroot
fi
msg "Creating the package"