← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5839: utility script to get build info from war file

 

------------------------------------------------------------
revno: 5839
committer: bobjolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-01-31 22:08:56 +0000
message:
  utility script to get build info from war file
added:
  resources/util/dhis2version


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'resources/util/dhis2version'
--- resources/util/dhis2version	1970-01-01 00:00:00 +0000
+++ resources/util/dhis2version	2012-01-31 22:08:56 +0000
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+
+# unpick and dump the build properties from a dhis2 war file
+# Bob Jolliffe 2012-01-31 v1
+
+if [[ "$#" != 1 ]]; then 
+  echo "usage:  $0 <dhis-war-file>"
+  exit 1
+fi
+
+test -e $1 || {
+  echo "error: $1 doesn't exist!"
+  exit 1
+}
+
+test -r $1 || {
+  echo "error: $1 is not readable!"
+  exit 1
+}
+ 
+
+COMMONS_JAR=$(mktemp)
+
+unzip -pqq $1 WEB-INF/lib/dhis-web-commons* > $COMMONS_JAR
+
+#TODO - test zero length
+test -s $COMMONS_JAR || { 
+  echo "Couldn't find dhis-web-commons-*.jar"
+  echo "Could be $1 is not a valid dhis war file?"     
+  rm $COMMONS_JAR
+  exit 1
+}
+
+BUILD_PROPS=$(unzip -p $COMMONS_JAR build.properties)
+
+# TODO - unpick these properties
+# for now just dump them ...
+echo $BUILD_PROPS
+
+# cleanup
+rm $COMMONS_JAR
+exit 0