summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-04-11 17:52:18 +0100
committerLeah Rowe <leah@libreboot.org>2025-04-11 17:52:18 +0100
commit0764c969a29b54166bb64e24e257f15a536a8be4 (patch)
tree7207da8611a2e6e0e81808b19e0a650ac64ce4ea /include/lib.sh
parentf98b9b0110770f5381055fbaa20610130131df62 (diff)
lbmk: use pwd util, not PWD environmental variable
PWD could be anything, if the user manually exported it before running lbmk. always run pwd instead, to get the real string. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r--include/lib.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 31c9fd02..4e527845 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -11,7 +11,7 @@ _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
ifdtool="elf/ifdtool/default/ifdtool"
cbfstool="elf/cbfstool/default/cbfstool"
rmodtool="elf/cbfstool/default/rmodtool"
-tmpgit="$PWD/tmp/gitclone"
+tmpgit="`pwd`/tmp/gitclone"
grubdata="config/data/grub"
err="err_"
@@ -102,18 +102,18 @@ 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"
# XBMK_CACHE is a directory, for caching downloads and git repositories
-[ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$PWD/cache"
-[ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$PWD/cache"
-[ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$PWD/cache" ] && \
- $err "cachedir is default, $PWD/cache, but it exists and is a symlink"
-[ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$PWD/cache"
+[ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="`pwd`/cache"
+[ -z "$XBMK_CACHE" ] && export XBMK_CACHE="`pwd`/cache"
+[ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "`pwd`/cache" ] && \
+ $err "cachedir is default, `pwd`/cache, but it exists and is a symlink"
+[ -L "$XBMK_CACHE" ] && export XBMK_CACHE="`pwd`/cache"
[ -f "$XBMK_CACHE" ] && $err "cachedir '$XBMK_CACHE' exists but it's a file"
# unify all temporary files/directories in a single TMPDIR
[ -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?"
+ [ -f "lock" ] && $err "`pwd`/lock exists. Is a build running?"
export TMPDIR="/tmp"
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
touch lock || $err "cannot create 'lock' file"