mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-24 21:54:11 +02:00
init.sh: break up xbmk_set_env
what this function does will differ wildly, depending on whether it's a child instance or a parent instance of xbmk. break up this function accordingly. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+44
-34
@@ -120,16 +120,10 @@ xbmk_set_env()
|
||||
|
||||
if [ "$is_child" = "y" ]
|
||||
then
|
||||
# child instance of xbmk, so we stop init after this point:
|
||||
# child instance of xbmk, so we stop init after this point
|
||||
# and execute the given user command upon return:
|
||||
|
||||
xbmk_child_set_tmp
|
||||
|
||||
if [ -z "${XBMK_CACHE+x}" ]; then
|
||||
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
||||
fi
|
||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
||||
xbmk_set_threads; :
|
||||
fi
|
||||
xbmk_child_set_env
|
||||
|
||||
return 1
|
||||
else
|
||||
@@ -138,6 +132,47 @@ xbmk_set_env()
|
||||
# command directly; instead, it calls a child instance
|
||||
# of xbmk, and exits with the corresponding return status.
|
||||
|
||||
xbmk_parent_set_env
|
||||
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
xbmk_child_set_env()
|
||||
{
|
||||
xbmk_child_set_tmp
|
||||
|
||||
if [ -z "${XBMK_CACHE+x}" ]; then
|
||||
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
||||
fi
|
||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
||||
xbmk_set_threads; :
|
||||
fi
|
||||
}
|
||||
|
||||
xbmk_child_set_tmp()
|
||||
{
|
||||
eval `setvars "" badtmp xbtmpchk locktmp`
|
||||
|
||||
xbtmpchk="`findpath "$TMPDIR" || err "!findpath $TMPDIR"`" || \
|
||||
err "!findpath '$TMPDIR'" "xbmk_child_set_tmp" "$@"
|
||||
|
||||
read -r locktmp < "$xbmklock" || \
|
||||
err "can't read '$xbmklock'" "xbmk_child_set_tmp" "$@"
|
||||
|
||||
if [ "$locktmp" != "$xbtmpchk" ]; then
|
||||
badtmp="TMPDIR '$xbtmpchk' changed; was '$locktmp'"
|
||||
|
||||
printf "bad TMPDIR init, '%s': %s\n" "$TMPDIR" "$badtmp" 1>&2
|
||||
err "'$xbmklock' present with bad tmpdir. is a build running?"
|
||||
fi
|
||||
|
||||
xbtmp="$xbtmpchk"
|
||||
export TMPDIR="$xbtmpchk"
|
||||
}
|
||||
|
||||
xbmk_parent_set_env()
|
||||
{
|
||||
xbmk_parent_check_tmp
|
||||
|
||||
printf "%s\n" "$xbtmp" > "$xbmklock" || \
|
||||
@@ -155,33 +190,8 @@ xbmk_set_env()
|
||||
remkdir "$xbtmp" "$xbtmp/gnupath" "$xbtmp/xbmkpath"
|
||||
|
||||
xbmk_set_pyver
|
||||
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
xbmk_child_set_tmp()
|
||||
{
|
||||
eval `setvars "" badtmp xbtmpchk locktmp`
|
||||
|
||||
xbtmpchk="`findpath "$TMPDIR" || err "!findpath $TMPDIR"`" || \
|
||||
err "!findpath '$TMPDIR'" xbmk_child_set_tmp "$@"
|
||||
|
||||
read -r locktmp < "$xbmklock" || \
|
||||
err "can't read '$xbmklock'" xbmk_child_set_tmp "$@"
|
||||
|
||||
if [ "$locktmp" != "$xbtmpchk" ]; then
|
||||
badtmp="TMPDIR '$xbtmpchk' changed; was '$locktmp'"
|
||||
|
||||
printf "bad TMPDIR init, '%s': %s\n" "$TMPDIR" "$badtmp" 1>&2
|
||||
err "'$xbmklock' present with bad tmpdir. is a build running?"
|
||||
fi
|
||||
|
||||
xbtmp="$xbtmpchk"
|
||||
export TMPDIR="$xbtmpchk"
|
||||
}
|
||||
|
||||
|
||||
xbmk_parent_check_tmp()
|
||||
{
|
||||
export TMPDIR="$basetmp"
|
||||
|
||||
Reference in New Issue
Block a user