From: Nathael Pajani Date: Sat, 1 May 2021 19:30:45 +0000 (+0200) Subject: Add script to update version number for a given project, possibly at each compilation X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=2b22e6e0162b8ef8fe7f1944563fc1dd5d557fe5;p=soft%2Flpc82x%2Fcore Add script to update version number for a given project, possibly at each compilation --- diff --git a/update_version.sh b/update_version.sh new file mode 100755 index 0000000..accaf0d --- /dev/null +++ b/update_version.sh @@ -0,0 +1,21 @@ +#! /bin/sh + +# This script must be run from the application directory which wants to use it + +# Check header file and version counter files presence +if [ ! -f .version ] ; then + echo "No initial version counter, setting to version 1" + echo 1 > .version +fi +if [ ! -f version.h ] ; then + echo "Need version.h file" + exit 3 +fi + +# Read and increment version number +i=$(cat .version) +i=$((i + 1)) +echo $i > .version + +#update version number in header file +sed -i "s/COMPILE_VERSION.*/COMPILE_VERSION \"$i\"/" version.h