2015-02-01 15:44:24 +01:00
#!/bin/sh
2018-01-14 11:17:14 -06:00
# Use this script to synchronize other scripts and installers with the version
2011-12-16 07:39:19 +00:00
# in mg-version.sh for a Version Release
# ----------------------------------------------------------------------------
# Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
2015-02-01 15:44:24 +01:00
# Copyright (c) 2011-2015 Mark Vejvoda under GNU GPL v3.0+
2011-12-16 07:39:19 +00:00
2015-03-09 00:34:59 +01:00
CURRENTDIR = " $( dirname " $( readlink -f " $0 " ) " ) "
cd " $CURRENTDIR "
2011-12-16 07:39:19 +00:00
CURRENT_VERSION = ` ./mg-version.sh --version`
2011-12-16 09:04:26 +00:00
OLD_VERSION = ` ./mg-version.sh --oldversion_binary`
2015-02-01 15:44:24 +01:00
VERSION_INFO_FILE = " $( dirname " $( readlink -f " $0 " ) " ) /../../source/version.txt "
LastCompatibleSaveGameVersion = " $( awk -F '=' '/^LastCompatibleSaveGameVersion =/ {print $2}' " $VERSION_INFO_FILE " | awk -F '"' '{print $2}' ) "
2016-11-02 19:50:03 +01:00
CurrYear = " $( date +%y) "
2015-02-02 22:20:57 +01:00
MapeditorVersion = " $CURRENT_VERSION "
G3dviewerVersion = " $CURRENT_VERSION "
2015-02-02 22:08:20 +01:00
modifymore = "yes"
2015-02-01 15:44:24 +01:00
echo
echo '===== Updating Game ======'
# const string glestVersionString = "v3.12-dev";
echo 'Game version # before:'
grep -E '^const string glestVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^const string glestVersionString = "[^"]*";$/const string glestVersionString = "v' $CURRENT_VERSION '";/' ../../source/glest_game/facilities/game_util.cpp
echo 'Game version # after:'
grep -E '^const string glestVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
echo
2016-11-02 19:50:03 +01:00
echo 'Game Copyright date # before:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/Copyright 2010-20[0-9][0-9] The MegaGlest Team/Copyright 2010-20' $CurrYear ' The MegaGlest Team/' ../../source/glest_game/facilities/game_util.cpp
2016-11-18 02:07:44 +01:00
grep -E '© 2001-20[0-9][0-9] The MegaGlest Team' ../../mk/macos/bundle_resources/Info.plist.in
sed -i 's/© 2001-20[0-9][0-9] The MegaGlest Team/© 2001-20' $CurrYear ' The MegaGlest Team/' ../../mk/macos/bundle_resources/Info.plist.in
2016-11-02 19:50:03 +01:00
echo 'Game Copyright date # after:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_game/facilities/game_util.cpp
2016-11-18 02:07:44 +01:00
grep -E '© 2001-20[0-9][0-9] The MegaGlest Team' ../../mk/macos/bundle_resources/Info.plist.in
2016-11-02 19:50:03 +01:00
echo
2015-02-01 15:44:24 +01:00
if [ " $modifymore " = "yes" ] ; then
# const string lastCompatibleSaveGameVersionString = "v3.9.0";
echo 'Compatible Save Game version # before:'
grep -E '^const string lastCompatibleSaveGameVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^const string lastCompatibleSaveGameVersionString = "[^"]*";$/const string lastCompatibleSaveGameVersionString = "v' $LastCompatibleSaveGameVersion '";/' ../../source/glest_game/facilities/game_util.cpp
echo 'Compatible Save Game version # after:'
grep -E '^const string lastCompatibleSaveGameVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
echo
fi
if [ " $modifymore " = "yes" ] && [ " $( git status >/dev/null 2>& 1; echo " $? " ) " -eq "0" ] ; then
2016-02-04 19:29:12 +01:00
# const string GIT_RawRev = "$4446.1a8673f$";
2017-02-18 13:13:00 +01:00
GitCommitForRelease = "`git rev-list HEAD --count`.`git log -1 --format=%h --abbrev=7`" ;
2015-02-01 15:44:24 +01:00
echo 'GitCommitForRelease # before:'
grep -E '^GitCommitForRelease = "[^"]*";$' " $VERSION_INFO_FILE "
2016-02-04 19:29:12 +01:00
grep -E '^ const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
2015-02-01 15:44:24 +01:00
sed -i 's/^GitCommitForRelease = "[^"]*";$/GitCommitForRelease = "' $GitCommitForRelease '";/' " $VERSION_INFO_FILE "
2016-02-04 19:29:12 +01:00
sed -i 's/^ const string GIT_RawRev = "$[^"]*";$/ const string GIT_RawRev = "$' $GitCommitForRelease '$";/' ../../source/glest_game/facilities/game_util.cpp
2015-02-01 15:44:24 +01:00
echo 'GitCommitForRelease # after:'
grep -E '^GitCommitForRelease = "[^"]*";$' " $VERSION_INFO_FILE "
2016-02-04 19:29:12 +01:00
grep -E '^ const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
2015-02-01 15:44:24 +01:00
fi
echo
if [ " $modifymore " = "yes" ] ; then
echo '===== Updating Mapeditor ======'
# const string mapeditorVersionString = "v1.6.1";
echo 'Mapeditor version # before:'
grep -E '^const string mapeditorVersionString = "[^"]*";$' ../../source/glest_map_editor/main.cpp
sed -i 's/^const string mapeditorVersionString = "[^"]*";$/const string mapeditorVersionString = "v' $MapeditorVersion '";/' ../../source/glest_map_editor/main.cpp
echo 'Mapeditor version # after:'
grep -E '^const string mapeditorVersionString = "[^"]*";$' ../../source/glest_map_editor/main.cpp
echo
2016-11-02 19:50:03 +01:00
echo 'Mapeditor Copyright date # before:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_map_editor/main.cpp
sed -i 's/Copyright 2010-20[0-9][0-9] The MegaGlest Team/Copyright 2010-20' $CurrYear ' The MegaGlest Team/' ../../source/glest_map_editor/main.cpp
echo 'Mapeditor Copyright date # after:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_map_editor/main.cpp
echo
2015-02-01 15:44:24 +01:00
echo '===== Updating G3dviewer ======'
# const string g3dviewerVersionString= "v1.3.6";
echo 'G3dviewer version # before:'
grep -E '^const string g3dviewerVersionString= "[^"]*";$' ../../source/g3d_viewer/main.cpp
sed -i 's/^const string g3dviewerVersionString= "[^"]*";$/const string g3dviewerVersionString= "v' $G3dviewerVersion '";/' ../../source/g3d_viewer/main.cpp
echo 'G3dviewer version # after:'
grep -E '^const string g3dviewerVersionString= "[^"]*";$' ../../source/g3d_viewer/main.cpp
fi
echo
2011-12-16 09:04:26 +00:00
echo '===== Updating Linux Installer ======'
# local GAME_VERSION = "x.x.x";
2011-12-16 07:39:19 +00:00
echo 'Linux Installer version # before:'
2015-10-11 19:19:00 +02:00
grep -E '^local GAME_VERSION = "[^"]*";$' tools-for-standalone-client/installer/scripts/config.lua
sed -i 's/^local GAME_VERSION = "[^"]*";$/local GAME_VERSION = "' $CURRENT_VERSION '";/' tools-for-standalone-client/installer/scripts/config.lua
2011-12-16 07:39:19 +00:00
echo 'Linux Installer version # after:'
2015-10-11 19:19:00 +02:00
grep -E '^local GAME_VERSION = "[^"]*";$' tools-for-standalone-client/installer/scripts/config.lua
2015-02-01 15:44:24 +01:00
echo
2011-12-16 09:04:26 +00:00
echo '===== Updating Windows Installer ======'
# !define APVER 3.6.0
echo 'Windows Installer version # before:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER [^"]*$' ../windows/Installer/MegaGlestInstaller.nsi
sed -i 's/^\!define APVER [^"]*$/\!define APVER ' $CURRENT_VERSION '/' ../windows/Installer/MegaGlestInstaller.nsi
2011-12-16 09:04:26 +00:00
echo 'Windows Installer version # after:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER [^"]*$' ../windows/Installer/MegaGlestInstaller.nsi
2015-02-01 15:44:24 +01:00
echo
if [ " $modifymore " = "yes" ] ; then
echo 'Windows Installer version # before:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER_OLD [^"]*$' ../windows/Installer/MegaGlestInstaller.nsi
sed -i 's/^\!define APVER_OLD [^"]*$/\!define APVER_OLD ' $OLD_VERSION '/' ../windows/Installer/MegaGlestInstaller.nsi
2015-02-01 15:44:24 +01:00
echo 'Windows Installer version # after:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER_OLD [^"]*$' ../windows/Installer/MegaGlestInstaller.nsi
2015-02-01 15:44:24 +01:00
echo
echo '===== Updating Windows Updater ======'
echo 'Windows Updater version # before:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER [^"]*$' ../windows/Installer/MegaGlestUpdater.nsi
sed -i 's/^\!define APVER [^"]*$/\!define APVER ' $CURRENT_VERSION '/' ../windows/Installer/MegaGlestUpdater.nsi
2015-02-01 15:44:24 +01:00
echo 'Windows Updater version # after:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER [^"]*$' ../windows/Installer/MegaGlestUpdater.nsi
2015-02-01 15:44:24 +01:00
echo
echo 'Windows Updater version # before:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER_OLD [^"]*$' ../windows/Installer/MegaGlestUpdater.nsi
sed -i 's/^\!define APVER_OLD [^"]*$/\!define APVER_OLD ' $OLD_VERSION '/' ../windows/Installer/MegaGlestUpdater.nsi
2015-02-01 15:44:24 +01:00
echo 'Windows Updater version # after:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER_OLD [^"]*$' ../windows/Installer/MegaGlestUpdater.nsi
2015-02-01 15:44:24 +01:00
echo
echo 'Windows Updater version # before:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER_UPDATE [^"]*$' ../windows/Installer/MegaGlestUpdater.nsi
sed -i 's/^\!define APVER_UPDATE [^"]*$/\!define APVER_UPDATE ' $CURRENT_VERSION '/' ../windows/Installer/MegaGlestUpdater.nsi
2015-02-01 15:44:24 +01:00
echo 'Windows Updater version # after:'
2018-01-14 11:17:14 -06:00
grep -E '^\!define APVER_UPDATE [^"]*$' ../windows/Installer/MegaGlestUpdater.nsi
2015-02-01 15:44:24 +01:00
echo
fi