aboutsummaryrefslogtreecommitdiff
path: root/NP-VERSION-GEN
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-11-23 05:38:47 +0000
committerGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-11-23 05:38:47 +0000
commit6fbd14fea5c111a23d9074d25499991cbfa58f79 (patch)
tree0c1f5a77cacc664eadd47216b70e3257337484db /NP-VERSION-GEN
parent56cf151ae91c5081a99365848a3f060dfe14a68c (diff)
downloadmonitoring-plugins-6fbd14fea5c111a23d9074d25499991cbfa58f79.tar.gz
Removing CVS/SVN tags and replacing with git-based versioning
For contrib/, full tags have been imported from subversion git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'NP-VERSION-GEN')
-rwxr-xr-xNP-VERSION-GEN46
1 files changed, 46 insertions, 0 deletions
diff --git a/NP-VERSION-GEN b/NP-VERSION-GEN
new file mode 100755
index 00000000..11697107
--- /dev/null
+++ b/NP-VERSION-GEN
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# This is from the Git repository (GIT-VERSION-GEN with modifications)
+#
+
+SRC_ROOT=`dirname $0`
+
+NPVF=NP-VERSION-FILE
+DEF_VER=1.4.13.git
+
+LF='
+'
+
+# First see if there is a version file (included in release tarballs),
+# then try git-describe, then default.
+if test -f $SRC_ROOT/version
+then
+ VN=`cat $SRC_ROOT/version` || VN="$DEF_VER"
+elif test -d $SRC_ROOT/.git -o -f $SRC_ROOT/.git &&
+ VN=`cd $SRC_ROOT; git describe --abbrev=4 HEAD 2>/dev/null` &&
+ case "$VN" in
+ *$LF*) (exit 1) ;;
+ release-[0-9]*)
+ git update-index -q --refresh
+ test -z "`git diff-index --name-only HEAD --`" ||
+ VN="$VN-dirty" ;;
+ esac
+then
+ VN=`echo "$VN" | sed -e 's/^release-//' | sed -e 's/-/./g'`;
+else
+ VN="$DEF_VER"
+fi
+
+VN=`expr "$VN" : v*'\(.*\)'`
+
+if test -r $NPVF
+then
+ VC=`sed -e 's/^NP_VERSION = //' <$NPVF`
+else
+ VC=unset
+fi
+test "$VN" = "$VC" || {
+ echo >&2 "NP_VERSION = $VN"
+ echo "NP_VERSION = $VN" >$NPVF
+}
+