summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-27 03:18:23 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-27 03:18:23 +0100
commitfac74cd60a3d90e6e0df971b481a55b0a01050c4 (patch)
tree55903b0d83895d9592a93ffb7bdf42d8fb7ffe92 /include
parent671893a802cb9f7b684037062d0debd1c049addb (diff)
lib.sh: simplified TMPDIR handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rwxr-xr-xinclude/lib.sh21
-rwxr-xr-xinclude/vendor.sh4
2 files changed, 10 insertions, 15 deletions
diff --git a/include/lib.sh b/include/lib.sh
index c57bbd0d..8b896f6b 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -10,7 +10,6 @@ _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
kbnotice="Insert a .gkb file from config/data/grub/keymap/ as keymap.gkb \
if you want a custom keymap in GRUB; use cbfstool from elf/cbfstool."
-tmpdir_was_set="y"
cbdir="src/coreboot/default"
cbelfdir="elf/coreboot_nopayload_DO_NOT_FLASH"
ifdtool="elf/ifdtool/default/ifdtool"
@@ -39,8 +38,8 @@ chkvars()
done
}
-eval `setvars "" tmpdir _nogit board boarddir relname versiondate projectsite \
- projectname aur_notice cfgsdir datadir version`
+eval `setvars "" _nogit board boarddir relname versiondate projectsite \
+ projectname aur_notice cfgsdir datadir version xbmk_parent`
for fv in projectname projectsite version versiondate; do
eval "[ ! -f "$fv" ] || read -r $fv < \"$fv\" || :"
@@ -82,19 +81,15 @@ install_packages()
id -u 1>/dev/null 2>/dev/null || $err "suid check failed (id -u)"
[ "$(id -u)" != "0" ] || $err "this command as root is not permitted"
-[ -z "${TMPDIR+x}" ] && tmpdir_was_set="n"
-if [ "$tmpdir_was_set" = "y" ]; then
- [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || tmpdir_was_set="n"
-fi
-if [ "$tmpdir_was_set" = "n" ]; then
+[ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || unset TMPDIR
+[ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR"
+
+if [ -z "${TMPDIR+x}" ]; then
[ -f "lock" ] && $err "$PWD/lock exists. Is a build running?"
export TMPDIR="/tmp"
- tmpdir="$(mktemp -d -t xbmk_XXXXXXXX)"
- export TMPDIR="$tmpdir"
+ export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
touch lock || $err "cannot create 'lock' file"
-else
- export TMPDIR="$TMPDIR"
- tmpdir="$TMPDIR"
+ xbmk_parent="y"
fi
# if "y": a coreboot target won't be built if target.cfg says release="n"
diff --git a/include/vendor.sh b/include/vendor.sh
index 949ffc48..d1a243e3 100755
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -41,10 +41,10 @@ getcfg()
[ -z "$vcfg" ] && printf "%s: vcfg unset\n" "$board" 1>&2 && return 1
- check_defconfig "$boarddir" 1>"$tmpdir/vendorcfg.list" && return 1
+ check_defconfig "$boarddir" 1>"$TMPDIR/vendorcfg.list" && return 1
while read -r cbcfgfile; do
set +u +e; . "$cbcfgfile" 2>/dev/null; set -u -e
- done < "$tmpdir/vendorcfg.list"
+ done < "$TMPDIR/vendorcfg.list"
[ -z "$tree" ] && $err "getcfg $boarddir: tree undefined"
cbdir="src/coreboot/$tree"