2020-12-30 13:06:29 +00:00
|
|
|
#!/usr/bin/bash
|
2021-05-14 16:52:38 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
2020-12-30 13:06:29 +00:00
|
|
|
#
|
2024-04-16 18:57:04 +00:00
|
|
|
# ES-DE Frontend
|
2021-05-14 16:52:38 +00:00
|
|
|
# update_version_string.sh
|
2020-12-30 13:06:29 +00:00
|
|
|
#
|
2023-12-16 11:30:13 +00:00
|
|
|
# Updates the version string for ES-DE.
|
2021-05-14 16:52:38 +00:00
|
|
|
# This script takes as arguments the major, minor and patch numbers as well as an optional
|
|
|
|
# alphanumeric suffix and updates all the necessary files to indicate a new software version.
|
|
|
|
# The script has to be run from within the tools directory.
|
2020-12-30 13:06:29 +00:00
|
|
|
#
|
2021-05-14 16:52:38 +00:00
|
|
|
# Example use:
|
2024-04-17 15:32:49 +00:00
|
|
|
# ./update_version_string.sh 3 0 2 beta
|
2020-12-30 13:06:29 +00:00
|
|
|
#
|
2021-05-14 16:52:38 +00:00
|
|
|
# The following files are updated by this script:
|
|
|
|
# es-app/CMakeLists.txt
|
2023-12-16 11:30:13 +00:00
|
|
|
# es-app/assets/ES-DE.plist
|
2023-07-21 09:45:58 +00:00
|
|
|
# es-app/assets/Windows_Portable_README.txt
|
2024-04-16 18:57:04 +00:00
|
|
|
# es-core/src/ApplicationVersion.h
|
2020-12-30 13:06:29 +00:00
|
|
|
#
|
2021-05-14 16:52:38 +00:00
|
|
|
# This script is only intended to be used on Linux systems.
|
2020-12-30 13:19:18 +00:00
|
|
|
#
|
2020-12-30 13:06:29 +00:00
|
|
|
|
|
|
|
if [ ! -f ../es-app/CMakeLists.txt ]; then
|
|
|
|
echo "You need to run this script from within the tools directory."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# -ne 3 ] && [ $# -ne 4 ]; then
|
|
|
|
echo "Usage: ./update_version_string.sh <major version> <minor version> <patch version> [<suffix>]"
|
|
|
|
echo "For example:"
|
2024-04-17 15:32:49 +00:00
|
|
|
echo "./update_version_string.sh 3 0 2 beta"
|
2020-12-30 13:06:29 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# -eq 4 ]; then
|
|
|
|
SUFFIX=-$4
|
|
|
|
else
|
|
|
|
SUFFIX=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
TEMPFILE=update_version_string.tmp
|
|
|
|
|
|
|
|
##### CMakeLists.txt
|
|
|
|
|
2022-04-19 15:32:10 +00:00
|
|
|
MODIFYFILE=../CMakeLists.txt
|
|
|
|
MODIFYSTRING=$(grep "set(ES_VERSION" $MODIFYFILE)
|
|
|
|
NEWSTRING="set(ES_VERSION ${1}.${2}.${3}${SUFFIX})"
|
2020-12-30 13:06:29 +00:00
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
2024-04-16 18:57:04 +00:00
|
|
|
##### ES-DE_Info.plist
|
|
|
|
|
|
|
|
MODIFYFILE=../es-app/assets/ES-DE_Info.plist
|
|
|
|
MODIFYSTRING=$(grep "<string>ES-DE " $MODIFYFILE)
|
|
|
|
OLDVERSION=$(echo $MODIFYSTRING | cut -f4 -d" " | sed s/".........$"//)
|
|
|
|
MODIFYSTRING=$(echo $MODIFYSTRING | sed s/".........$"//)
|
|
|
|
NEWSTRING="<string>ES-DE ${1}.${2}.${3}"
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
|
|
|
MODIFYSTRING=$(grep -m1 "<string>${OLDVERSION}" $MODIFYFILE)
|
|
|
|
MODIFYSTRING=$(echo $MODIFYSTRING | sed s/".........$"//)
|
|
|
|
# Adding the suffix is not fully compliant with the Apple documentation but seems to be working.
|
|
|
|
# It's not used for the release builds anyway so it should hopefully not be an issue.
|
|
|
|
NEWSTRING="<string>${1}.${2}.${3}${SUFFIX}"
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
|
|
|
##### Windows_Portable_README.txt
|
|
|
|
|
|
|
|
ROW_NUM=$(grep -n "ES-DE release:" ../es-app/assets/Windows_Portable_README.txt | cut -f1 -d:)
|
|
|
|
ROW_NUM=$((ROW_NUM+1))
|
|
|
|
NEWSTRING=${1}.${2}.${3}${SUFFIX}
|
|
|
|
sed -i ${ROW_NUM}s/.*/$(echo $NEWSTRING | unix2dos)/ ../es-app/assets/Windows_Portable_README.txt
|
|
|
|
|
2023-12-16 11:30:13 +00:00
|
|
|
##### ApplicationVersion.h
|
2020-12-30 13:06:29 +00:00
|
|
|
|
2024-04-16 18:57:04 +00:00
|
|
|
MODIFYFILE=../es-core/src/ApplicationVersion.h
|
2021-07-05 18:53:35 +00:00
|
|
|
|
|
|
|
MODIFYSTRING=$(grep "PROGRAM_VERSION_MAJOR " $MODIFYFILE)
|
|
|
|
NEWSTRING="#define PROGRAM_VERSION_MAJOR ${1}"
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
|
|
|
MODIFYSTRING=$(grep "PROGRAM_VERSION_MINOR " $MODIFYFILE)
|
|
|
|
NEWSTRING="#define PROGRAM_VERSION_MINOR ${2}"
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
|
|
|
MODIFYSTRING=$(grep "PROGRAM_VERSION_MAINTENANCE " $MODIFYFILE)
|
|
|
|
NEWSTRING="#define PROGRAM_VERSION_MAINTENANCE ${3}"
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
2020-12-30 13:06:29 +00:00
|
|
|
MODIFYSTRING=$(grep "PROGRAM_VERSION_STRING" $MODIFYFILE)
|
|
|
|
NEWSTRING="#define PROGRAM_VERSION_STRING \"${1}.${2}.${3}${SUFFIX}\""
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
|
|
|
MODIFYSTRING=$(grep "RESOURCE_VERSION_STRING" $MODIFYFILE)
|
|
|
|
MODIFYSTRING=$(echo $MODIFYSTRING | sed s/"...$"//)
|
|
|
|
NEWSTRING="#define RESOURCE_VERSION_STRING \"${1},${2},${3}"
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
2023-02-16 21:24:42 +00:00
|
|
|
MODIFYSTRING=$(grep "PROGRAM_RELEASE_NUMBER" $MODIFYFILE)
|
|
|
|
OLDRELEASE=$(grep "PROGRAM_RELEASE_NUMBER" $MODIFYFILE | sed "s/[^0-9]//g")
|
|
|
|
((NEWRELEASE=OLDRELEASE+1))
|
|
|
|
echo "Increased release number from ${OLDRELEASE} to ${NEWRELEASE}"
|
|
|
|
NEWSTRING=$(grep "PROGRAM_RELEASE_NUMBER" $MODIFYFILE | sed "s/$OLDRELEASE/$NEWRELEASE/")
|
|
|
|
|
|
|
|
cat $MODIFYFILE | sed s/"${MODIFYSTRING}"/"${NEWSTRING}"/ > $TEMPFILE
|
|
|
|
mv $TEMPFILE $MODIFYFILE
|
|
|
|
|
2020-12-30 13:06:29 +00:00
|
|
|
echo "Done updating, don't forget to run generate_man_page.sh once the binary has been compiled with the new version string."
|