From 0800319d2676ad6c3f73c6dd6c7cafcdc052de50 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 10 May 2016 01:06:34 -0400 Subject: librechroot: Revert running arch-nspawn and mkarchroot in subshells. It screws with the exit status. Instead, take advantage of dynamic scoping to avoid mutating arch_nspawn_flags (the reason I switched them to subshells). --- src/chroot-tools/librechroot | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index e671814..7cfe125 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -85,10 +85,11 @@ hack_arch_nspawn_flags() { } # Usage: arch-nspawn $copydir $cmd... -arch-nspawn() ( +arch-nspawn() { local copydir=$1; shift local cmd=("$@") + local arch_nspawn_flags=(${arch_nspawn_flags+"${arch_nspawn_flags[@]}"}) hack_arch_nspawn_flags "$copydir" "$_arch_nspawn" \ @@ -97,20 +98,21 @@ arch-nspawn() ( ${sysd_nspawn_flags+"${sysd_nspawn_flags[@]}"} \ -- \ "${cmd[@]}" -) +} # Usage: mkarchroot $copydir $pkgs... -mkarchroot() ( +mkarchroot() { local copydir=$1; shift local pkgs=("$@") + local arch_nspawn_flags=(${arch_nspawn_flags+"${arch_nspawn_flags[@]}"}) hack_arch_nspawn_flags "$copydir" unshare -m "$_mkarchroot" \ ${arch_nspawn_flags+"${arch_nspawn_flags[@]}"} \ "$copydir" \ "${pkgs[@]}" -) +} # Usage: _makechrootpkg $function $arguments... # Don't load $_makechrootpkg directly because it doesn't work with -euE -- cgit v1.2.2