#!/usr/bin/env sh set -eu : "${PACKAGER_NAME=}" . ./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. # https://docs.microsoft.com/en-us/windows/win32/menurc/stringfileinfo-block # https://github.com/josephspurrier/goversioninfo/blob/master/testdata/resource/versioninfo.json cat > ./cli/winresources/versioninfo.json < "./cli/winresources/winresources.go" fi