summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-10 01:06:34 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-10 01:06:34 -0400
commit0800319d2676ad6c3f73c6dd6c7cafcdc052de50 (patch)
tree005b4e53f0f32e66abae2ce7772ff8d944a00e63 /src/chroot-tools/librechroot
parent0464341cd8fc4ae34b608fb018b8baaeba9e841a (diff)
librechroot: Revert running arch-nspawn and mkarchroot in subshells.v20160510
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).
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-xsrc/chroot-tools/librechroot10
1 files 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