init.sh: looser XBMK_THREADS validation

on child processes, we can simply correct it.

we currently provide an error message, but this is silly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
25.06_branch
Leah Rowe 2025-05-19 18:53:22 +01:00
parent fa59f9da76
commit b516a29482
1 changed files with 9 additions and 6 deletions

View File

@ -30,7 +30,7 @@ xbmk_init()
id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" 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" [ "$(id -u)" != "0" ] || err "this command as root is not permitted"
for init_cmd in get_version set_env git_init child_exec; do for init_cmd in get_version set_env set_threads git_init child_exec; do
xbmk_$init_cmd "$@" || break xbmk_$init_cmd "$@" || break
done done
} }
@ -76,7 +76,7 @@ xbmk_set_env()
if [ "$is_child" = "y" ]; then if [ "$is_child" = "y" ]; then
[ -z "${XBMK_CACHE+x}" ] && err "XBMK_CACHE unset on child" [ -z "${XBMK_CACHE+x}" ] && err "XBMK_CACHE unset on child"
[ -z "${XBMK_THREADS+x}" ] && err "XBMK_THREADS unset on child" [ -z "${XBMK_THREADS+x}" ] && xbmk_set_threads
e "lock" f missing && err "lock file absent on child" e "lock" f missing && err "lock file absent on child"
return 1 return 1
fi fi
@ -104,10 +104,6 @@ xbmk_set_env()
[ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y"
[ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n"
[ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1
expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || export XBMK_THREADS=1
xbmk_set_version xbmk_set_version
export LOCALVERSION="-$projectname-${version%%-*}" export LOCALVERSION="-$projectname-${version%%-*}"
@ -117,6 +113,13 @@ xbmk_set_env()
xbmk_set_pyver xbmk_set_pyver
} }
xbmk_set_threads()
{
[ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1
expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || export XBMK_THREADS=1
}
xbmk_set_version() xbmk_set_version()
{ {
version_="$version" version_="$version"