aboutsummaryrefslogtreecommitdiff
path: root/version.sh
diff options
context:
space:
mode:
authorValerio Mariani <valerio.mariani@desy.de>2014-05-06 17:51:47 +0200
committerThomas White <taw@physics.org>2014-05-21 16:04:23 +0200
commit8c212e3abb7f4343affeb5e9e1092b59d3b74075 (patch)
treefd6629a34ebe77b2fc0ac9afc77eb5ffff77c9af /version.sh
parent2658f7ca3fbdd0f037b9286812e6967b42517c0d (diff)
Added reporting of version number to all program and stream file
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/version.sh b/version.sh
new file mode 100755
index 00000000..1be14f69
--- /dev/null
+++ b/version.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+top_srcdir=$1
+
+CRYSTFEL_BASE_VERSION=$( cf=( `grep PACKAGE_VERSION config.h` ); echo ${cf[2]} | sed -n 's/"//gp' )
+sed 's/\$u\$/'${CRYSTFEL_BASE_VERSION}'/g' $top_srcdir/version.h.in > version1.tmp
+command -v git > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+ if [ -d ".git" ]; then
+ git log -1 --pretty=%B | grep 'This is CrystFEL' > /dev/null
+ if [ $? -eq 0 ]; then
+ CRYSTFEL_GIT_COMMIT=""
+ else
+ CRYSTFEL_GIT_COMMIT="+"`git rev-parse HEAD`
+ fi
+ fi
+fi
+sed 's/\$e\$/'${CRYSTFEL_GIT_COMMIT}'/g' version1.tmp > version2.tmp
+diff version.h version2.tmp > /dev/null
+if [ $? -ne 0 ]; then
+ mv version2.tmp version.h
+ rm version1.tmp
+else
+ rm version1.tmp version2.tmp
+fi