summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-18 13:32:24 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-18 13:32:24 +0100
commit2702a43a86d51aba2123d620ce2f383d8fc41311 (patch)
tree8b221458c994d0b07c46ad0cab144b0188c271ab
parentfc4006ce877231f63a941eca903c0af9416e8ab8 (diff)
init.sh: merge xbmk_lock() with xbmk_set_env()HEADmaster
it's just two lines, and we want much more granular control of where the lock is enforced. it should be JUST after confirming that the instance is a parent. it is at this moment that we should bail if a lock file exists, because this signals that another instance of xbmk is running. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--include/init.sh12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/init.sh b/include/init.sh
index 35512469..ee19c398 100644
--- a/include/init.sh
+++ b/include/init.sh
@@ -30,8 +30,7 @@ xbmk_init()
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"
- for init_cmd in get_version set_env lock git_init child_exec
- do
+ for init_cmd in get_version set_env git_init child_exec; do
xbmk_$init_cmd "$@" || break
done
}
@@ -82,6 +81,9 @@ xbmk_set_env()
return 1
fi
+ [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?"
+ touch "$xbmklock" || err "cannot create '$xbmklock'"; :
+
# parent instance of xbmk, so don't return. set up TMPDIR
export TMPDIR="/tmp"
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
@@ -189,12 +191,6 @@ pybin()
command -v "$1" 2>/dev/null || return 1
}
-xbmk_lock()
-{
- [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?"
- touch "$xbmklock" || err "cannot create '$xbmklock'"; :
-}
-
xbmk_git_init()
{
for gitarg in "--global user.name" "--global user.email"; do