diff options
-rwxr-xr-x | libremakepkg | 42 | ||||
-rw-r--r-- | rePKGBUILD.proto | 2 |
2 files changed, 28 insertions, 16 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" diff --git a/rePKGBUILD.proto b/rePKGBUILD.proto index 0126ee0..ef3f037 100644 --- a/rePKGBUILD.proto +++ b/rePKGBUILD.proto @@ -20,7 +20,7 @@ build() { } package() { - find ${srcdir} -type l -maxdepth 1 -delete + find ${srcdir} -maxdepth 1 -type l -delete cp -a ${srcdir}/* ${pkgdir} } |