File: version.sh

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (23 lines) | stat: -rwxr-xr-x 772 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#
# This script extracts the version from global/src/gacommon.h, which is the master
# location for this information.
#
filename="global/src/gacommon.h"

if [ ! -f $filename ]; then
    echo "version.sh: error: global/src/gacommon.h does not exist" 1>&2
    exit 1
fi
MAJOR=`egrep '^#define +GA_VERSION_MAJOR +[0-9]+$' $filename`
MINOR=`egrep '^#define +GA_VERSION_MINOR +[0-9]+$' $filename`
PATCH=`egrep '^#define +GA_VERSION_PATCH +[0-9]+$' $filename`
if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
    echo "version.sh: error: could not extract version from $filename" 1>&2
    exit 1
fi
MAJOR=`echo $MAJOR | awk '{ print $3 }'`
MINOR=`echo $MINOR | awk '{ print $3 }'`
PATCH=`echo $PATCH | awk '{ print $3 }'`
echo $MAJOR.$MINOR.$PATCH | tr -d '\n'