diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-13 14:30:02 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-13 14:33:37 +0100 |
| commit | e9e33d4b4d6c7d2fc48f667c9f19ab710203228d (patch) | |
| tree | 9b4b7b14c82f644703fc044445d6bf6a0626d3dc /include | |
| parent | 3b37a0b17da9b3308447b01661da091722dbf639 (diff) | |
lib.sh: always sanitize xbmkver before writing
this removed the need to check it in xbmk_set_version
as it calls update_xbmkver, which in turn performs
the same check.
this increases the general reliability and safety of
xbmk when recording its own version after update.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/init.sh | 4 | ||||
| -rw-r--r-- | include/lib.sh | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/include/init.sh b/include/init.sh index 25e2dc75..d0edb3fb 100644 --- a/include/init.sh +++ b/include/init.sh @@ -259,10 +259,6 @@ xbmk_set_version() versiondate="$(git show --no-patch --no-notes \ --pretty='%ct' HEAD)" || versiondate="$versiondate_" - if [ -z "$version" ] || [ -z "$versiondate" ]; then - err "version and/or versiondate unset" "xbmk_set_version" "$@" - fi - update_xbmkver "." relname="$projectname-$version" diff --git a/include/lib.sh b/include/lib.sh index 427a6aec..8bcfc216 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -26,6 +26,9 @@ update_xbmkver() { xbmk_sanitize_version + [ -z "${version-}${versiondate-}" ] && \ + err "version and/or versiondate unset" "update_xbmkver" "$@" + printf "%s\n" "$version" > "$1/.version" || \ err "can't write '$1'" "update_xbmkver" "$@"; : |
