summaryrefslogtreecommitdiff
path: root/tools/version.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/version.sh')
-rw-r--r--tools/version.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/version.sh b/tools/version.sh
new file mode 100644
index 00000000..f1cc5948
--- /dev/null
+++ b/tools/version.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test -d .git ; then
+if type git >/dev/null 2>&1 ; then
+git describe --tags --match 'v[0-9]*' 2>/dev/null \
+| sed -e 's/^v//' -e 's/-/-git-/'
+else
+sed 's/$/-git/' < VERSION
+fi
+else
+cat VERSION
+fi