summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-04-17 23:43:22 +0100
committerLeah Rowe <leah@libreboot.org>2025-04-17 23:43:22 +0100
commite07a2adb130e86cf78fc1ee77a4d8b233a65cedf (patch)
tree322fef83ab84abebe14c05b3b4f9be9b7912f0c9 /include/lib.sh
parent9d3b52cd1d2c91912476ac4622ef33726e349e54 (diff)
lbmk: don't handle TMPDIR directly
lbmk creates TMPDIR as /tmp/xbmk_*, but it's theoretically possible that something could re-export it by mistake. this change retains the same initialisation, but further use is now via a new variable "xbmktmp", that stores the value of TMPDIR upon lbmk's initialisation of it. this reduces the chance of such a bug in the future, as described above, so it is a preemptive/preventative fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r--include/lib.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/lib.sh b/include/lib.sh
index e0c9b1a2..8de19d2a 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -50,7 +50,7 @@ chkvars()
}
eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \
- datadir version relname`"
+ datadir version relname xbmktmp`"
for fv in version versiondate; do
eval "[ ! -f \".$fv\" ] || read -r $fv < \".$fv\" || :"
@@ -127,6 +127,7 @@ if [ -z "${TMPDIR+x}" ]; then
[ -f "lock" ] && $err "$xbmkpwd/lock exists. Is a build running?"
export TMPDIR="/tmp"
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
+ xbmktmp="$TMPDIR"
touch lock || $err "cannot create 'lock' file"
x_ rm -Rf "$XBMK_CACHE/xbmkpath" "$XBMK_CACHE/gnupath"
x_ mkdir -p "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath"
@@ -144,6 +145,7 @@ if [ -z "${TMPDIR+x}" ]; then
rm -f lock || xbmk_rval=1
exit $xbmk_rval
fi
+xbmktmp="$TMPDIR"
# 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)