summaryrefslogtreecommitdiffstats
path: root/git-version-gen
blob: 6feac3405e83ea282b0af4341bb84f0a3297884d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
SRCDIR=`dirname $0`
if test -n "$1"; then
  VER=$1
else
  if test -d "${SRCDIR}/.git" && test -x "`which git`" ; then
    git update-index -q --refresh
    VER=`git describe --tags --always --dirty=-dirty`
  else
    if test -f "${SRCDIR}/.tarball-version"; then
      VER=`cat "${SRCDIR}/.tarball-version"`
    fi
  fi
fi
printf %s "$VER"