Add distribution tarball generator script
[charm.git] / src / scripts / commitid.sh
blobf69c72983f1c459daab6d9684b4aeeb3e01a1184
1 #!/bin/bash
3 # Get a string describing the current code, and compare it to the
4 # recorded value in VERSION. Copy over that if it's changed, so that
5 # Make sees a more recent file.
7 VOLD=""
8 if test -r VERSION
9 then
10 VOLD=`cat VERSION`
13 # Potentially set by the higher-level package-tarball.sh script
14 if [ "$RELEASE" = "1" ]
15 then
16 echo Release mode
17 (cd $SRCBASE && git describe --exact-match) > VERSION.new || exit 1
18 else
19 echo Dev mode
20 (cd $SRCBASE && git describe --long --always) > VERSION.new || touch VERSION.new
23 VNEW=`cat VERSION.new`
25 if test -n "$VNEW" -a "$VOLD" != "$VNEW"
26 then
27 cp VERSION.new VERSION
28 echo Copying VERSION.new = $VNEW over VERSION = $VOLD