From 18ad654a1f71dd8734bf45d6c9f7062b80bdd144 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 26 Apr 2025 22:02:26 +0100 Subject: 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 --- include/init.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'include/init.sh') diff --git a/include/init.sh b/include/init.sh index 1518f358..1a383bd7 100644 --- a/include/init.sh +++ b/include/init.sh @@ -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 -- cgit v1.2.1