summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-18 12:51:56 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-18 12:54:31 +0100
commit94437278dc7c3635e760f8781e9e151575845cad (patch)
treebf99fd92624132b4e6f175dd9f6d00d5c839acbc
parent6b603b9fbf45f6f391f84ecc8ced7896722f6b02 (diff)
init.sh: simplify unknown version creation
we don't need to read or write a file at all, in that case. we only then need to generate one if running ./mk release. the scenario in which no .git and no version files exist is when someone grabs the build system from a snapshot generated by e.g. forgejo instances. it's ill advised, so we advise against it, but it is mitigated in code. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--include/init.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/init.sh b/include/init.sh
index e94157f0..20d63068 100644
--- a/include/init.sh
+++ b/include/init.sh
@@ -55,10 +55,8 @@ xbmk_get_version()
[ ! -f ".version" ] || read -r version < ".version" || :; :
[ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; :
- [ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > ".version" \
- || err "Cannot generate unknown .version file"
- [ -e ".git" ] || [ -f ".versiondate" ] || printf "1716415872\n" > \
- ".versiondate" || err "Can't generate unknown versiondate file"; :
+ [ ! -e ".git" ] && [ ! -f ".version" ] && version="unknown"
+ [ ! -e ".git" ] && [ ! -f ".versiondate" ] && versiondate="1716415872"
version_="$version"
[ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \