diff options
Diffstat (limited to 'src/chroot-tools/chcleanup')
-rwxr-xr-x | src/chroot-tools/chcleanup | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 2ff45f9..bfb65ce 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -1,13 +1,29 @@ #!/usr/bin/env bash -set -eE -# (c) Nicolás Reynolds <fauno@parabola.nu> -# Released under GPLv3 +# Copyright (C) 2011-2012 Nicolás Reynolds <fauno@parabola.nu> +# Copyright (C) 2012-2013 Luke Shumaker <lukeshu@sbcglobal.net> +# +# License: GNU GPLv3+ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + # Performs chroot cleanup smartly, it only removes the unneeded packages or # leaves you with a cleansystem # # See: HOOKPREBUILD +set -eE + DRYRUN=${DRYRUN:-false} ################################################################################ @@ -34,11 +50,6 @@ msg2() { printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } -warning() { - local mesg="$(_ "$1")"; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - error() { local mesg="$(_ "$1")"; shift printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 @@ -67,8 +78,8 @@ msg "Cleaning chroot..." cp /repo/repo.db /var/lib/pacman/sync/repo.db # Setup the temporary directory -TEMPDIR="$(mktemp --tmpdir -d $(basename $0).XXXXX)" -trap "rm -rf '$TEMPDIR'" EXIT +TEMPDIR="$(mktemp --tmpdir -d ${0##*/}.XXXXXXXXXX)" +trap "rm -rf -- $(printf '%q' "$TEMPDIR")" EXIT cp -a /var/lib/pacman/sync "${TEMPDIR}/" pkglist="${TEMPDIR}"/pkglist.txt |