Take new exe file as arg in vcarve-pro-makerspace-12.0/update.sh

This commit is contained in:
Adam Goldsmith 2024-10-16 15:00:58 -04:00
parent ca58cdd42e
commit 65ae1717ce

View File

@ -1,12 +1,16 @@
#!/bin/bash #!/bin/bash
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" if [ -z "$1" ]
then
echo "Usage: $0 NEW_EXE"
exit 1
fi
file="$1"
file=$(ls tools/VCarveProMakerspaceEditionV120*_Setup.exe) version=$(7z e -so $file ProductInfo.ini | awk -F= '$1=="product_version" { print $2 }')
version=$(7z e -so $file ProductInfo.ini | awk -F= '$1=="product_version" { print $2 }')
major_version=$(awk -F. -v RS='\r\n' '{print $1"."$2}' <<< $version) major_version=$(awk -F. -v RS='\r\n' '{print $1"."$2}' <<< $version)
minor_version=$(awk -F. -v RS='\r\n' '{print $3"."$4}' <<< $version) minor_version=$(awk -F. -v RS='\r\n' '{print $3"."$4}' <<< $version)
checksum=$(sha256sum $file | awk '{print $1}') checksum=$(sha256sum $file | awk '{print $1}')
if [ "$major_version" != "12.0" ] if [ "$major_version" != "12.0" ]
then then
@ -14,6 +18,7 @@ then
exit 1 exit 1
fi fi
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
echo "Current version for ${PWD##*/}: major=$major_version, minor=$minor_version, checksum=$checksum" echo "Current version for ${PWD##*/}: major=$major_version, minor=$minor_version, checksum=$checksum"
sed -i "s|<version>[^<]*</version>|<version>$minor_version</version>|" "${PWD##*/}.nuspec" sed -i "s|<version>[^<]*</version>|<version>$minor_version</version>|" "${PWD##*/}.nuspec"