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>
This commit is contained in:
Leah Rowe
2025-04-17 23:43:22 +01:00
parent 9d3b52cd1d
commit e07a2adb13
4 changed files with 22 additions and 19 deletions
+6 -5
View File
@@ -12,7 +12,8 @@ mkserprog()
[ "$1" = "pico" ] && mkpicotool
basename -as .h "$serdir/"*.h > "$TMPDIR/ser" || $err "!mk $1 $TMPDIR"
basename -as .h "$serdir/"*.h > "$xbmktmp/ser" || \
$err "!mk $1 $xbmktmp"
while read -r sertarget; do
[ "$1" = "pico" ] &&
@@ -31,7 +32,7 @@ mkserprog()
"$sersrc" BOARD=$sertarget
x_ mkdir -p "bin/serprog_$1"
x_ mv "$serx" "bin/serprog_$1/serprog_$sertarget.${serx##*.}"
done < "$TMPDIR/ser"
done < "$xbmktmp/ser"
[ "$XBMK_RELEASE" = "y" ] && mkrom_tarball "bin/serprog_$1"; :
}
@@ -115,7 +116,7 @@ mkcorebootbin()
{
[ "$target" = "$tree" ] && return 0
tmprom="$TMPDIR/coreboot.rom"
tmprom="$xbmktmp/coreboot.rom"
$dry x_ cp "$srcdir/build/coreboot.rom" "$tmprom"
initmode="${defconfig##*/}"
@@ -201,8 +202,8 @@ add_grub()
_grubname="fallback/payload"
cbfs "$tmprom" "$grubelf" "$_grubname"
printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \
> "$TMPDIR/tmpcfg" || $err "$target: !insert scandisk"
cbfs "$tmprom" "$TMPDIR/tmpcfg" scan.cfg raw
> "$xbmktmp/tmpcfg" || $err "$target: !insert scandisk"
cbfs "$tmprom" "$xbmktmp/tmpcfg" scan.cfg raw
[ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ] && \
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
"background.png" raw; :