diff options
Diffstat (limited to 'src/chroot-tools/chcleanup.in')
-rw-r--r-- | src/chroot-tools/chcleanup.in | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in index 10256dd..a76dd67 100644 --- a/src/chroot-tools/chcleanup.in +++ b/src/chroot-tools/chcleanup.in @@ -63,7 +63,7 @@ fi # NOTE: The in-chroot pkgconfdir is non-configurable. # This is intentionally hard-coded. -source /etc/libretools.d/chroot.conf +source /etc/libretools.d/chroot.conf # sets $CHROOTEXTRAPKG # NOTE: ARM chroots require 'fakeroot-tcp' (BR #2775) fakeroot_pkg=fakeroot$( [[ "$(uname -m)" == 'armv7l' ]] && echo '-tcp' ) @@ -100,7 +100,7 @@ cp -a -t "${TEMPDIR}/db" -- /var/lib/pacman/sync ln -sfT -- /dev/null "$TEMPDIR/hooks/${hook##*/}" done done -pacman=(pacman --dbpath="$TEMPDIR/db" --hookdir="$TEMPDIR/hooks") +pkglist_cmd=(pacman --dbpath="$TEMPDIR/db" --hookdir="$TEMPDIR/hooks") # Do our best to preload the scratch DB with CHROOTPKG and # CHROOTEXTRAPKG packages. This is purely an optimization step. The @@ -112,29 +112,29 @@ while read -r pkg; do if [[ -d /var/lib/pacman/local/$pkg ]]; then cp -a -T -- "/var/lib/pacman/local/$pkg" "$TEMPDIR/db/local/$pkg" fi -done < <("${pacman[@]}" -Sp --print-format='%n-%v' -- "${CHROOTPKG[@]}" "${CHROOTEXTRAPKG[@]}") +done < <("${pkglist_cmd[@]}" -Sp --print-format='%n-%v' -- "${CHROOTPKG[@]}" "${CHROOTEXTRAPKG[@]}") # Get the full list of packages needed by dependencies, including the base system msg2 "Creating a full list of packages..." -for var in CHROOTPKG CHROOTEXTRAPKG DEPENDS; do - declare -n pkgsref="$var" - if [[ $var = DEPENDS ]]; then - mapfile -t pkgs < <("${pacman[@]}" -T -- "${pkgsref[@]}") +for pkglist in CHROOTPKG CHROOTEXTRAPKG DEPENDS; do + declare -n pkgsref="$pkglist" + if [[ $pkglist = DEPENDS ]]; then + mapfile -t pkgs < <("${pkglist_cmd[@]}" -T -- "${pkgsref[@]}") else pkgs=("${pkgsref[@]}") fi - if (( ${#pkgs[@]} == 0 )); then - continue + (( ${#pkgs[@]} > 0 )) || continue + fi - "${pacman[@]}" -S --dbonly --noscriptlet --needed --noconfirm -- "${pkgs[@]}" <&- >& "$TEMPDIR/pacman.txt" || ret=$? + "${pkglist_cmd[@]}" -S --dbonly --noscriptlet --needed --noconfirm -- "${pkgs[@]}" <&- >& "$TEMPDIR/pacman.txt" || ret=$? if (( ret != 0 )); then error "Could not create a full list of packages, exiting." plain "This is likely caused by a dependency that could not be found." - sed 's/^/ > /' <"$TEMPDIR/pacman.txt" >&2 + sed 's/^/ > /' < "$TEMPDIR/pacman.txt" >&2 exit $ret fi done -"${pacman[@]}" -Qq >"$TEMPDIR/pkglist.txt" +"${pkglist_cmd[@]}" -Qq > "$TEMPDIR/pkglist.txt" # Diff installed packages against a clean chroot then remove leftovers packages=($(comm -23 <(pacman -Qq | sort -u) \ |