From 4c55c0216c1efe94eeb9cad91b6052e463c9d57b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 9 May 2016 22:27:09 -0400 Subject: librechroot: skip initialization steps when mode=delete When viewing this diff, you should ignore whitespace change. It just moved an "if" block up a ways. --- src/chroot-tools/librechroot | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index cb74f98..e6b3a3a 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -357,36 +357,36 @@ main() { lock 9 "$copydir.lock" \ "Waiting for existing lock on chroot copy to be released: [%s]" "$COPY" - if ! check_mountpoint "$copydir.lock"; then - error "Chroot copy is mounted with nosuid or noexec options: [%s]" "$COPY" - return 1 - fi - - if [[ ! -d $rootdir ]]; then - msg "Creating 'root' copy for chroot [%s]" "$CHROOT" - mkarchroot "$rootdir" base-devel - make_empty_repo "$rootdir" - fi + if [[ $mode != delete ]]; then + if ! check_mountpoint "$copydir.lock"; then + error "Chroot copy is mounted with nosuid or noexec options: [%s]" "$COPY" + return 1 + fi - if [[ ! -d $copydir ]] || [[ $mode == sync ]]; then - msg "Syncing copy [%s] with root copy" "$COPY" - _makechrootpkg sync_chroot "$CHROOTDIR/$CHROOT" "$COPY" - fi + if [[ ! -d $rootdir ]]; then + msg "Creating 'root' copy for chroot [%s]" "$CHROOT" + mkarchroot "$rootdir" base-devel + make_empty_repo "$rootdir" + fi - # Note: the in-chroot pkgconfdir is non-configurable, this is - # intentionally hard-coded. - mkdir -p "$copydir/etc/libretools.d" - { - if [[ ${#CHROOTEXTRAPKG[*]} -eq 0 ]]; then - echo 'CHROOTEXTRAPKG=()' - else - printf 'CHROOTEXTRAPKG=(' - printf '%q ' "${CHROOTEXTRAPKG[@]}" - printf ')\n' + if [[ ! -d $copydir ]] || [[ $mode == sync ]]; then + msg "Syncing copy [%s] with root copy" "$COPY" + _makechrootpkg sync_chroot "$CHROOTDIR/$CHROOT" "$COPY" fi - } > "$copydir"/etc/libretools.d/chroot.conf - if [[ $mode != delete ]]; then + # Note: the in-chroot pkgconfdir is non-configurable, this is + # intentionally hard-coded. + mkdir -p "$copydir/etc/libretools.d" + { + if [[ ${#CHROOTEXTRAPKG[*]} -eq 0 ]]; then + echo 'CHROOTEXTRAPKG=()' + else + printf 'CHROOTEXTRAPKG=(' + printf '%q ' "${CHROOTEXTRAPKG[@]}" + printf ')\n' + fi + } > "$copydir"/etc/libretools.d/chroot.conf + # "touch" the chroot first # this will # - overwrite '/etc/pacman.d/mirrorlist'" -- cgit v1.2.3