summaryrefslogtreecommitdiff
path: root/include/option.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-05-24 14:53:45 +0100
committerLeah Rowe <leah@libreboot.org>2024-05-24 14:53:45 +0100
commitb8ec7d56404481c6917107f980e8ff90aaf13781 (patch)
treeb8d69e8681f953ed8cbd1d156f6f0cd0eff1caed /include/option.sh
parent87c361f3df2c585206613e368d5be73a2c0fd126 (diff)
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>
Diffstat (limited to 'include/option.sh')
-rwxr-xr-xinclude/option.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/option.sh b/include/option.sh
index bfeb9eb3..3648ecd2 100755
--- a/include/option.sh
+++ b/include/option.sh
@@ -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}"