summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/export.sh22
-rwxr-xr-xlbmk21
2 files changed, 23 insertions, 20 deletions
diff --git a/include/export.sh b/include/export.sh
new file mode 100755
index 00000000..9e393485
--- /dev/null
+++ b/include/export.sh
@@ -0,0 +1,22 @@
+# Copyright (c) 2023 Leah Rowe <leah@libreboot.org>
+# SPDX-License-Identifier: MIT
+
+tmpdir=""
+tmpdir_was_set="y"
+set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
+if [ "${tmpdir_was_set}" = "y" ]; then
+ tmpdir="${TMPDIR##*/}"
+ tmpdir="${TMPDIR%_*}"
+ if [ "${tmpdir}" = "lbmk" ]; then
+ tmpdir=""
+ tmpdir_was_set="n"
+ fi
+fi
+if [ "${tmpdir_was_set}" = "n" ]; then
+ export TMPDIR="/tmp"
+ tmpdir="$(mktemp -d -t lbmk_XXXXXXXX)"
+ export TMPDIR="${tmpdir}"
+else
+ export TMPDIR="${TMPDIR}"
+fi
+tmpdir="${TMPDIR}"
diff --git a/lbmk b/lbmk
index 175cf394..285e109f 100755
--- a/lbmk
+++ b/lbmk
@@ -25,26 +25,7 @@
set -u -e
. "include/err.sh"
-
-tmpdir=""
-tmpdir_was_set="y"
-set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
-if [ "${tmpdir_was_set}" = "y" ]; then
- tmpdir="${TMPDIR##*/}"
- tmpdir="${TMPDIR%_*}"
- if [ "${tmpdir}" = "lbmk" ]; then
- tmpdir=""
- tmpdir_was_set="n"
- fi
-fi
-if [ "${tmpdir_was_set}" = "n" ]; then
- export TMPDIR="/tmp"
- tmpdir="$(mktemp -d -t lbmk_XXXXXXXX)"
- export TMPDIR="${tmpdir}"
-else
- export TMPDIR="${TMPDIR}"
-fi
-tmpdir="${TMPDIR}"
+. "include/export.sh"
projectname="$(cat projectname)"
buildpath=""