init.sh: merge xbmk_child_init with xbmk_init

the for loop at the end of xbmk_init does essentially
the same thing. adapt accordingly, and merge.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-04-26 22:02:26 +01:00
parent 1526820247
commit 18ad654a1f
+7 -13
View File
@@ -51,8 +51,9 @@ xbmk_init()
eval "[ ! -f \".$fv\" ] || read -r $fv < \".$fv\" || :"
done
for xbmk_cmd in setpyver init_vars init_ver xbmk_child_init; do
$xbmk_cmd "$@"
for init_cmd in set_pyver init_vars init_ver create_tmpdir lock \
create_pathdirs child_exec; do
xbmk_$init_cmd "$@" || break
done
}
@@ -86,7 +87,7 @@ chkvars()
done; :
}
setpyver()
xbmk_set_pyver()
{
pyv="import sys; print(sys.version_info[:])"
python="python3"
@@ -136,7 +137,7 @@ pybin()
command -v "$1" 2>/dev/null || return 1
}
init_vars()
xbmk_init_vars()
{
# XBMK_CACHE is a directory, for caching downloads and git repon
[ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache"
@@ -158,10 +159,10 @@ init_vars()
[ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > .version \
|| $err "Cannot generate unknown .version file"
[ -e ".git" ] || [ -f ".versiondate" ] || printf "1716415872\n" > \
.versiondate || $err "Cannot generate unknown .versiondate file"
.versiondate || $err "Cannot generate unknown .versiondate file"; :
}
init_ver()
xbmk_init_ver()
{
version_="$version"
[ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \
@@ -178,13 +179,6 @@ init_ver()
export LOCALVERSION="-$projectname-${version%%-*}"
}
xbmk_child_init()
{
for init_cmd in create_tmpdir lock create_pathdirs child_exec; do
xbmk_$init_cmd "$@" || return 0; :
done
}
xbmk_create_tmpdir()
{
# unify all temporary files/directories in a single TMPDIR