From b190e9e7918ed416289f02fc9effbdf87d3cbebc Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 22 Aug 2012 21:28:31 -0300 Subject: [PATCH] Add update_version.sh script (which updates resources_win32.rc version now). --- scripts/create_release.sh | 13 +++---------- scripts/update_version.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 scripts/update_version.sh diff --git a/scripts/create_release.sh b/scripts/create_release.sh index 9c9afb342..71e08e5ca 100644 --- a/scripts/create_release.sh +++ b/scripts/create_release.sh @@ -32,21 +32,14 @@ fi # Update version # -------------- -cd $destdir -cat config.h \ - | sed -e "s/define VERSION.*/define VERSION \"$version\"/" \ - > tmp -mv tmp config.h - -cat data/gui.xml \ - | sed -e "s/gui version=\".*/gui version=\"$version\">/" \ - > tmp -mv tmp data/gui.xml +cd $destdir/scripts +sh update_version.sh $version # ---------------------------------------------- # Make a build/ directory and compile with cmake # ---------------------------------------------- +cd $destdir if [ ! -d build ] ; then mkdir build cd build diff --git a/scripts/update_version.sh b/scripts/update_version.sh new file mode 100644 index 000000000..6746aad34 --- /dev/null +++ b/scripts/update_version.sh @@ -0,0 +1,33 @@ +#! /bin/sh + +if [ ! -f update_version.sh ]; then + echo You must run update_version.sh from scripts/ directory + exit 1 +fi + +version=$1 +if [ "$version" == "" ]; then + echo Usage: update_version.sh VERSION + exit 1 +fi + +version_win32=$(echo $1 | sed -e 's/\./,/g' | sed -e 's/-.*$//') +commas=$(grep -o "," <<< "$version_win32" | wc -l) + +while [ $commas -lt 3 ] ; do + version_win32+=",0" + commas=$(grep -o "," <<< "$version_win32" | wc -l) +done + +sed -e "s/define VERSION.*/define VERSION \"$version\"/" < ../config.h > tmp +mv tmp ../config.h + +sed -e "s/gui version=\".*/gui version=\"$version\">/" < ../data/gui.xml > tmp +mv tmp ../data/gui.xml + +sed -e "s/FILEVERSION .*/FILEVERSION $version_win32/" < ../src/resources_win32.rc \ + | sed -e "s/PRODUCTVERSION .*/PRODUCTVERSION $version_win32/" \ + | sed -e "s/FileVersion\",.*/FileVersion\", \"$version_win32\"/" \ + | sed -e "s/ProductVersion\",.*/ProductVersion\", \"$version_win32\"/" \ + > tmp +mv tmp ../src/resources_win32.rc