summaryrefslogtreecommitdiff
path: root/chcleanup
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-07 00:17:08 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-07 00:17:08 -0500
commite9bc885c355babf7851de31db8e1920dde752993 (patch)
treefd39b7d6401ead53942f66bfc4219a06f386a23f /chcleanup
parentc74d072dc83c5e3b3d9462678884cd0411a7d1d0 (diff)
organize the files
Diffstat (limited to 'chcleanup')
-rwxr-xr-xchcleanup57
1 files changed, 0 insertions, 57 deletions
diff --git a/chcleanup b/chcleanup
deleted file mode 100755
index 17c1f02..0000000
--- a/chcleanup
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/bash
-# (c) Nicolás Reynolds <fauno@parabola.nu>
-# Released under GPLv3
-#
-# Performs chroot cleanup smartly, it only removes the unneeded packages or
-# leaves you with a cleansystem
-#
-# See: HOOKPREBUILD
-
-set -e
-DRYRUN=${DRYRUN:-false}
-
-source /etc/makepkg.conf
-source /etc/libretools.conf
-source ${HOME}/.makepkg.conf 2>/dev/null|| true
-
-msg "Cleaning chroot..."
-
-TMPDIR="$(mktemp -d /tmp/$(basename $0)-XXXXX)"
-cleanup_log="${TMPDIR}"/libretools-cleanup.log
-
-cp -a /var/lib/pacman/sync "${TMPDIR}/"
-touch ${cleanup_log}
-
-# If we're running makepkg
-if [ -f PKGBUILD ]; then
- source PKGBUILD || true
-
- check=(${depends[@]} ${makedepends[@]} ${checkdepends[@]})
-
-fi
-
-# Get the full list of packages needed by dependencies, including the base system
-sudo pacman -b "${TMPDIR}" \
- -Sp \
- --print-format "%n" \
- base base-devel sudo \
- ${CHROOTEXTRAPKG[@]} \
- ${check[@]} \
- >${cleanup_log}
-
-# Diff installed packages against a clean chroot then remove leftovers
-packages=($(comm -23 <(pacman -Qq | sort) \
- <(sort -u ${cleanup_log})))
-
-[ ${#packages[@]} -eq 0 ] && exit 0
-
-msg2 "Removing %d packages" ${#packages[@]}
-
-# Only remove leftovers, -Rcs removes too much
-${DRYRUN} || sudo pacman --noconfirm -Rn ${packages[@]}
-${DRYRUN} && echo ${packages[@]}
-
-# Cleanup
-${DRYRUN} || rm -fr ${TMPDIR}
-
-exit $?