diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:48:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:48:22 +0000 |
commit | 7373ce3d6988706388f136e1c06afd20a3e8d5be (patch) | |
tree | e9ae5af7d102667e5706187646db45de8238e8c4 /NP-VERSION-GEN | |
parent | Initial commit. (diff) | |
download | monitoring-plugins-7373ce3d6988706388f136e1c06afd20a3e8d5be.tar.xz monitoring-plugins-7373ce3d6988706388f136e1c06afd20a3e8d5be.zip |
Adding upstream version 2.3.5.upstream/2.3.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'NP-VERSION-GEN')
-rwxr-xr-x | NP-VERSION-GEN | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/NP-VERSION-GEN b/NP-VERSION-GEN new file mode 100755 index 0000000..2453774 --- /dev/null +++ b/NP-VERSION-GEN @@ -0,0 +1,53 @@ +#!/bin/sh +# +# This is from the Git repository (GIT-VERSION-GEN with modifications) +# + +SRC_ROOT=`dirname $0` + +NPVF=NP-VERSION-FILE +DEF_VER=2.3.5 + +LF=' +' + +# First try git-describe, then svn info, then default. +if 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'`; +elif test -d $SRC_ROOT/.svn -o -f $SRC_ROOT/.svn && + VN=`cd $SRC_ROOT; svn info 2>/dev/null | grep '^Revision'` && + case "$VN" in + *$LF*) (exit 1) ;; + Revision:*) + VN=`echo $VN | awk '{print $NF}'` + test "`svn status 2>/dev/null | grep '^[AMD]' | wc -l | tr -d ' '`" = 0 || + VN="$VN-dirty" ;; + esac +then + VN=`echo "trunk.$VN" | 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 +} + |