summaryrefslogtreecommitdiff
path: root/version.sh
diff options
context:
space:
mode:
authorPrzemyslaw Pawelczyk <przemoc@gmail.com>2015-12-01 01:44:21 +0100
committerPrzemyslaw Pawelczyk <przemoc@gmail.com>2015-12-01 01:44:21 +0100
commitf27108a4b114c9d83de25d2beba5c7c0a1d1c20b (patch)
tree9b63198c3b7cddb255dddc370821491a73fc788f /version.sh
parent3e572265776cac1ee01c27bb227d15becf4aa3d0 (diff)
Add action to show metastore version: -v / --version.
Fixes #36.
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/version.sh b/version.sh
new file mode 100755
index 0000000..6716dff
--- /dev/null
+++ b/version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+METASTORE_PRETAG_VER=1.0.999
+
+cd "${0%/*}" && \
+METASTORE_VER="$(\
+{ git describe --tags 2>/dev/null \
+ || grep -no '^v[0-9][^ ]*' NEWS \
+ || echo $METASTORE_PRETAG_VER; \
+} | sed '/^1:/s,,,;/:/{s,[^:]*:,,;s,$,+,};q' \
+)"
+
+echo "$METASTORE_VER_PREFIX$METASTORE_VER$METASTORE_VER_SUFFIX"