| 1 |
#!/bin/sh |
| 2 |
SRCDIR=`dirname $0` |
| 3 |
if test -n "$1"; then |
| 4 |
VER=$1 |
| 5 |
else |
| 6 |
if test -r "${SRCDIR}/.git" && test -x "`which git`" ; then |
| 7 |
git update-index -q --refresh |
| 8 |
if ! VER=`git describe --tags --dirty 2>/dev/null`; then |
| 9 |
COMMIT=`git rev-parse --short HEAD` |
| 10 |
DIRTY=`git diff --quiet HEAD || echo "-dirty"` |
| 11 |
VER=`sed -n '1,/RE/s/Version \(.*\)/\1/p' ${SRCDIR}/NEWS`-git-${COMMIT}${DIRTY} |
| 12 |
fi |
| 13 |
else |
| 14 |
if test -f "${SRCDIR}/.tarball-version"; then |
| 15 |
VER=`cat "${SRCDIR}/.tarball-version"` |
| 16 |
fi |
| 17 |
fi |
| 18 |
fi |
| 19 |
VER=`printf %s "$VER" | head -n1` |
| 20 |
printf %s "$VER" |