summaryrefslogtreecommitdiff
path: root/include/init.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-18 11:18:45 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-18 11:18:45 +0100
commitcde3b7051e4c9276a35f608e7709e3a7e480b01e (patch)
tree8897185069654fff8b0ab4f9f7c4ab5a293f93ba /include/init.sh
parent7ec9ee42283f3722a5c3bfd0050dd32b00a32973 (diff)
init.sh: return from child in set_env instead
This is earlier than the current check, thus preventing the initialisation of a git repository and/or the recreation of xbmktmp and xbmklocal by erroneous parent executions of lbmk while another parent is running - the latter of which could have caused a massively unpredictable build failure, so this is also a pre-emptive bug fix, fixing all kinds of weird bugs. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/init.sh')
-rw-r--r--include/init.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/init.sh b/include/init.sh
index 2dd9e88f..60dd3dd9 100644
--- a/include/init.sh
+++ b/include/init.sh
@@ -146,6 +146,17 @@ xbmk_set_env()
[ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1
expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || export XBMK_THREADS=1; :
+
+ # unify all temporary files/directories in a single TMPDIR
+ [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \
+ unset TMPDIR
+ [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR"
+ [ -z "${TMPDIR+x}" ] || return 1 # child instance, so return
+
+ # parent instance of xbmk, so don't return. set up TMPDIR
+ export TMPDIR="/tmp"
+ export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
+ xbmktmp="$TMPDIR"
}
xbmk_git_init()
@@ -171,17 +182,6 @@ xbmk_create_tmpdir()
{
x_ mkdir -p "$xbmklocal"
- # unify all temporary files/directories in a single TMPDIR
- [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \
- unset TMPDIR
- [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR"
- [ -z "${TMPDIR+x}" ] || return 1 # child instance, so return
-
- # parent instance of xbmk, so don't return. set up TMPDIR
- export TMPDIR="/tmp"
- export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
- xbmktmp="$TMPDIR"
-
# /tmp might be a tmpfs, so for large files we use ./tmp,
# not to be confused with xbmktmp (xbmktmp points to /tmp)
remkdir "$xbmktmp" "$xbmklocal"