option.sh: generate version file if .git not found

a user was getting error "version unset" when using the
tarball generated from codeberg. it's recommended to use
the git repository properly, or a release archive.

mitigate this so that the build succeeds anyway.

Signed-off-by: Leah Rowe <leah@libreboot.org>
20240612_branch
Leah Rowe 2024-05-24 14:53:45 +01:00
parent 87c361f3df
commit b8ec7d5640
1 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,11 @@ x_() {
[ $# -lt 1 ] || ${@} || $err "Unhandled non-zero exit: $@"; return 0
}
[ -e ".git" ] || [ -d "version" ] || printf "unknown\n" > version || \
$err "Cannot generate unknown version file"
[ -e ".git" ] || [ -d "versiondate" ] || printf "1716415872\n" > versiondate || \
$err "Cannot generate unknown versiondate file"
read -r projectname < projectname || :
[ ! -f version ] || read -r version < version || :
version_="${version}"