From 22edabb58446c66c76b9ba71748ae91f656b2a24 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 31 Mar 2022 21:14:24 +0200 Subject: [PATCH] fix version quad logic that trims 0 digit so returns an empty one Signed-off-by: CrazyMax --- scripts/build/mkversioninfo | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/build/mkversioninfo b/scripts/build/mkversioninfo index 488e8ccdcd..8bc30edbd1 100755 --- a/scripts/build/mkversioninfo +++ b/scripts/build/mkversioninfo @@ -3,14 +3,19 @@ set -eu : "${PACKAGER_NAME=}" +quadVersionNum() { + num=$(echo "${1:-0}" | cut -d. -f"$2") + if [ "$num" != "0" ]; then + echo "${num#0}" + else + echo "$num" + fi +} + . ./scripts/build/.variables # Create version quad for Windows of the form major.minor.patch.build VERSION_QUAD=$(printf "%s" "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | sed -re 's/\.$//' | sed -re 's/^[0-9]+$/\0\.0/' | sed -re 's/^[0-9]+\.[0-9]+$/\0\.0/' | sed -re 's/^[0-9]+\.[0-9]+\.[0-9]+$/\0\.0/') -VERSION_MAJOR=$(echo "${VERSION_QUAD:-0}" | cut -d. -f1) -VERSION_MINOR=$(echo "${VERSION_QUAD:-0}" | cut -d. -f2) -VERSION_PATCH=$(echo "${VERSION_QUAD:-0}" | cut -d. -f3) -VERSION_BUILD=$(echo "${VERSION_QUAD:-0}" | cut -d. -f4) # Generate versioninfo.json to be able to create a syso file which contains # Microsoft Windows Version Information and an icon using goversioninfo. @@ -21,10 +26,10 @@ cat > ./cli/winresources/versioninfo.json <