diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-09 22:27:09 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-09 22:27:09 -0400 |
commit | 4c55c0216c1efe94eeb9cad91b6052e463c9d57b (patch) | |
tree | b44b08d5625d799202a4c2f255e5eb8932509a92 /src | |
parent | 338d0ad21f01db708c40e06745afd20749a82926 (diff) |
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.
Diffstat (limited to 'src')
-rwxr-xr-x | src/chroot-tools/librechroot | 52 |
1 files 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'" |