summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-04 13:53:08 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-04 13:57:32 +0100
commit7d562679becb4c9a905c37bd45896edaf9faf9ca (patch)
tree75b60de6a35433ae3264c23904a7c60f92574f8c /include/lib.sh
parent53dd4bc4dd86cc490f5b481e8644fa58511820fb (diff)
lib.sh bugfix: check environmental variables right
A user had TMUX_TMPDIR set, which broke the TMPDIR check Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rwxr-xr-xinclude/lib.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/lib.sh b/include/lib.sh
index b335ace3..8868975b 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -43,14 +43,16 @@ setvars()
eval "$(setvars "" xbmk_release tmpdir _nogit version board boarddir relname \
versiondate threads projectname projectsite)"
+
# if "y": a coreboot target won't be built if target.cfg says release="n"
# (this is used to exclude certain build targets from releases)
-set | grep XBMK_RELEASE 1>/dev/null 2>/dev/null || xbmk_release="n" || :
+
+[ -z "${XBMK_RELEASE+x}" ] && xbmk_release="n"
[ -z "$xbmk_release" ] && xbmk_release="$XBMK_RELEASE"
[ "$xbmk_release" = "n" ] || [ "$xbmk_release" = "y" ] || xbmk_release="n"
export XBMK_RELEASE="$xbmk_release"
-set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
+[ -z "${TMPDIR+x}" ] && tmpdir_was_set="n"
if [ "$tmpdir_was_set" = "y" ]; then
[ "${TMPDIR%_*}" = "/tmp/xbmk" ] || tmpdir_was_set="n"
fi
@@ -63,7 +65,7 @@ else
tmpdir="$TMPDIR"
fi
-set | grep XBMK_THREADS 1>/dev/null 2>/dev/null && threads="$XBMK_THREADS"
+[ -z "${XBMK_THREADS+x}" ] || threads="$XBMK_THREADS"
[ -z "$threads" ] && threads=1
expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer