diff options
Diffstat (limited to 'include/init.sh')
-rw-r--r-- | include/init.sh | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/include/init.sh b/include/init.sh index 1be860ea..d2db0236 100644 --- a/include/init.sh +++ b/include/init.sh @@ -31,7 +31,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 set_pyver set_env set_version git_init create_tmpdir \ + for init_cmd in set_pyver set_version set_env git_init create_tmpdir \ lock create_pathdirs child_exec; do xbmk_$init_cmd "$@" || break done @@ -80,8 +80,7 @@ pybin() # ideally, don't rely on PATH or hardcoded paths if python venv. # use the *real*, direct executable linked to by the venv symlink if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then - # realpath isn't posix, but available mostly universally - pypath="$(realpath \ + pypath="$(findpath \ "$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)" [ -e "$pypath" ] && [ ! -d "$pypath" ] && \ [ -x "$pypath" ] && printf "%s\n" "$pypath" && return 0; : @@ -98,26 +97,6 @@ pybin() command -v "$1" 2>/dev/null || return 1 } -xbmk_set_env() -{ - # XBMK_CACHE is a directory, for caching downloads and git repon - [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ - err "cachedir '$xbmkpwd/cache' is a symlink" - [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -f "$XBMK_CACHE" ] && err "cachedir '$XBMK_CACHE' is a file"; : - - # if "y": a coreboot target won't be built if target.cfg says release="n" - # (this is used to exclude certain build targets from releases) - [ -z "${XBMK_RELEASE+x}" ] && 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() { [ ! -f ".version" ] || read -r version < ".version" || :; : @@ -140,7 +119,32 @@ xbmk_set_version() printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" relname="$projectname-$version" +} + +xbmk_set_env() +{ export LOCALVERSION="-$projectname-${version%%-*}" + + # XBMK_CACHE is a directory, for caching downloads and git repon + [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" + [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" + [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ + err "cachedir '$xbmkpwd/cache' is a symlink" + [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" + xbmkcache="`findpath "$XBMK_CACHE"`" || \ + err "Can't resolve cachedir: '$XBMK_CACHE'" + export XBMK_CACHE="$xbmkcache" + [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : + + # if "y": a coreboot target won't be built if target.cfg says release="n" + # (this is used to exclude certain build targets from releases) + [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" + [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" + [ "$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_git_init() |