summaryrefslogtreecommitdiffstats
path: root/src/check_version
blob: 8600c556f4c0b7ffb6ed3bf91f1ec08fe65cfb9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

dname=`dirname $0`

if [ ! -d $dname/../.git ]; then
    echo "not updating .git_version (no $dname/../.git)"
    exit 0
fi

cur=`cd $dname && git rev-parse HEAD 2>/dev/null; git describe 2>/dev/null`
[ -e $1 ] && old=`cat $1`

if [ "$cur" != "$old" ]; then
    echo regenerating $1 with $cur
    echo "$cur" > $1
else
    echo $1 is up to date.
fi