summaryrefslogtreecommitdiff
path: root/include/export.sh
blob: ada84e9209ba166d3f610619d00fdc0dc615f74e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>

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}"