1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00
rufus/_chver.sh
Pete Batard ca4e009ffc
[appstore] revert to using a script to build AppStore bundle
* Having two separate Visual Studio solution files, while more convenient, was a major
  pain in the ass and it also required us to update versioning in the .appxmanifest for
  each commit.
* Also, this new AppStore build process enables us to use the GitHub Actions executables
  to further foster the complete transparency of our build process.
2021-10-27 09:47:27 +01:00

37 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
# Changes the version number
# !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!!
type -P sed &>/dev/null || { echo "sed command not found. Aborting." >&2; exit 1; }
if [ ! -n "$1" ]; then
echo "you must provide a version number (eg. 2.1)"
exit 1
else
MAJOR=`echo $1 | sed "s/\(.*\)[.].*/\1/"`
MINOR=`echo $1 | sed "s/.*[.]\(.*\)/\1/"`
fi
case $MAJOR in *[!0-9]*)
echo "$MAJOR is not a number"
exit 1
esac
case $MINOR in *[!0-9]*)
echo "$MINOR is not a number"
exit 1
esac
echo "changing version to $MAJOR.$MINOR"
sed -i -e "s/^AC_INIT(\[\([^ ]*\)\], \[[^ ]*\]\(.*\)/AC_INIT([\1], [$MAJOR.$MINOR]\2/" configure.ac
cat > cmd.sed <<\_EOF
s/^\([ \t]*\)\(FILE\|PRODUCT\)VERSION\([ \t]*\)[0-9]*,[0-9]*\(.*\)/\1\2VERSION\3@@MAJOR@@,@@MINOR@@\4/
s/^\([ \t]*\)VALUE\([ \t]*\)"\(File\|Product\)Version",\([ \t]*\)"[0-9]*\.[0-9]*\.\(.*\)/\1VALUE\2"\3Version",\4"@@MAJOR@@.@@MINOR@@.\5/
s/^\([ \t]*\)VALUE\([ \t]*\)"OriginalFilename",\([ \t]*\)"rufus-[0-9]*\.[0-9]*\.exe\(.*\)/\1VALUE\2"OriginalFilename",\3"rufus-@@MAJOR@@.@@MINOR@@.exe\4/
s/^\(.*\)"Rufus [0-9]*\.[0-9]*\.\(.*\)"\(.*\)/\1"Rufus @@MAJOR@@.@@MINOR@@.\2"\3/
s/^\([ \t]*\)Version="[0-9]*\.[0-9]*\.\(.*\)"\(.*\)/\1Version="@@MAJOR@@.@@MINOR@@.\2"\3/
s/^set VERSION=[0-9]*\.[0-9]*/set VERSION=@@MAJOR@@.@@MINOR@@/
_EOF
# First run sed to substitute our variable in the sed command file
sed -i -e "s/@@MAJOR@@/$MAJOR/g" -e "s/@@MINOR@@/$MINOR/g" cmd.sed
sed -b -i -f cmd.sed src/rufus.rc
rm cmd.sed
source ./bootstrap.sh