summaryrefslogtreecommitdiff
path: root/src/chroot-tools
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-04-20 23:05:01 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-04-20 23:19:37 -0400
commitcdc456c8b7c6e3eb4b11d668fb9c6e9bdec7230e (patch)
treed54d0c816a146023fbc7a54c0d5f71ecd0e69937 /src/chroot-tools
parent23213bda24af601acbbea5731246a055680b48d0 (diff)
Don't use subshells in local/export/declare commands.
Only make this change in places where it shouldn't make a difference, and something weird has to be going on for the subshell to fail. This is on par with checking the return value of malloc. We don't need tests for each of these failure cases.
Diffstat (limited to 'src/chroot-tools')
-rw-r--r--src/chroot-tools/chcleanup.in3
-rw-r--r--src/chroot-tools/hooks-distcc.sh4
-rwxr-xr-xsrc/chroot-tools/librechroot5
-rwxr-xr-xsrc/chroot-tools/libremakepkg3
4 files changed, 9 insertions, 6 deletions
diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in
index a7d2fb4..7981120 100644
--- a/src/chroot-tools/chcleanup.in
+++ b/src/chroot-tools/chcleanup.in
@@ -55,7 +55,8 @@ fi
source /etc/libretools.d/chroot.conf
# If we're running makepkg
if [[ -f PKGBUILD ]]; then
- export CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")"
+ CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")"
+ export CARCH
source ./PKGBUILD
CHROOTEXTRAPKG+=("${depends[@]}"
"${makedepends[@]}"
diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh
index bb234b8..74edb85 100644
--- a/src/chroot-tools/hooks-distcc.sh
+++ b/src/chroot-tools/hooks-distcc.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Copyright (C) 2013 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright (C) 2013, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
#
# License: GNU GPLv2+
#
@@ -62,7 +62,7 @@ distcc_start() {
_distcc_check
- local _distcc_tool="$(librelib chroot/distcc-tool)"
+ local _distcc_tool; _distcc_tool="$(librelib chroot/distcc-tool)"
install -m755 "$_distcc_tool" "$copydir/bin/distcc-tool"
mkdir -p "$home/.ssh"
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index dc242b2..fba7e91 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -180,8 +180,9 @@ calculate_directories() {
check_mountpoint() {
local file=$1
- local mountpoint="$(df -P "$file"|sed '1d;s/.*\s//')"
- local mountopts=($(LC_ALL=C mount|awk "{ if (\$3==\"$mountpoint\") { gsub(/[(,)]/, \" \", \$6); print \$6 } }"))
+ local mountpoint mountopts
+ mountpoint="$(df -P "$file"|sed '1d;s/.*\s//')"
+ mountopts=($(LC_ALL=C mount|awk "{ if (\$3==\"$mountpoint\") { gsub(/[(,)]/, \" \", \$6); print \$6 } }"))
! in_array nosuid "${mountopts[@]}" && ! in_array noexec "${mountopts[@]}"
}
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index d74c78b..5b86c03 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -268,7 +268,8 @@ main() {
# Set target CARCH
# note that we waited until after locking/creating the chroot to do this
- export CARCH="$(MAKEPKG_CONF=$copydir/etc/makepkg.conf get_var makepkg CARCH)"
+ CARCH="$(MAKEPKG_CONF=$copydir/etc/makepkg.conf get_var makepkg CARCH)"
+ export CARCH
# Pre-build
msg 'Starting pre-build activities...'