trim leading 0 for minor in the version quad

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-03-31 15:54:39 +02:00
parent 58d425d3bf
commit 525845572a
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
1 changed files with 8 additions and 4 deletions

View File

@ -7,6 +7,10 @@ set -eu
# 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.
@ -17,10 +21,10 @@ cat > ./cli/winresources/versioninfo.json <<EOL
"FixedFileInfo":
{
"FileVersion": {
"Major": $(echo "${VERSION_QUAD:-0}" | cut -d. -f1),
"Minor": $(echo "${VERSION_QUAD:-0}" | cut -d. -f2),
"Patch": $(echo "${VERSION_QUAD:-0}" | cut -d. -f3),
"Build": $(echo "${VERSION_QUAD:-0}" | cut -d. -f4)
"Major": ${VERSION_MAJOR},
"Minor": ${VERSION_MINOR#0},
"Patch": ${VERSION_PATCH},
"Build": ${VERSION_BUILD}
},
"FileFlagsMask": "3f",
"FileFlags ": "00",