Merge branch 'main/atys-live' into fixes
[ryzomcore.git] / dist / debian / ryzomcore_version.sh
blob4f9f5beaca3eb39c9bfe3dd14a1b2543bb64d33d
1 #!/bin/sh
3 CODEROOT=$1
5 if [ -z "$CODEROOT" ]
6 then
7 CODEROOT=../../code
8 fi
10 VERSION_FILE=$CODEROOT/CMakeLists.txt
12 if [ ! -f $VERSION_FILE ]
13 then
14 echo "Unable to find $VERSION_FILE"
15 exit 1
18 parse_version()
20 PREFIX=$1
21 FILE=$2
22 VAR=$3
24 V=$(egrep -o $PREFIX"_$VAR [0-9]+" $FILE | awk '{print $2}' | head -n 1)
26 if [ -z "$V" ]
27 then
28 echo "Can't parse $VAR from $FILE, aborting..."
29 exit 1
32 export $VAR=$V
35 parse_version RYZOM $VERSION_FILE VERSION_MAJOR
36 parse_version RYZOM $VERSION_FILE VERSION_MINOR
37 parse_version RYZOM $VERSION_FILE VERSION_PATCH
39 VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH
41 echo $VERSION
43 exit 0