Merge pull request #2721 from elfiesmelfie/update_README
[collectd.git] / version-gen.sh
index f0f8dca..f16e661 100755 (executable)
@@ -1,13 +1,13 @@
 #!/bin/sh
 
-DEFAULT_VERSION="5.5.2.git"
+DEFAULT_VERSION="5.8.0.git"
 
-VERSION="`git describe 2> /dev/null | grep collectd | sed -e 's/^collectd-//'`"
+if [ -d .git ]; then
+       VERSION="`git describe --dirty=+ --abbrev=7 2> /dev/null | grep collectd | sed -e 's/^collectd-//' -e 's/-/./g'`"
+fi
 
 if test -z "$VERSION"; then
        VERSION="$DEFAULT_VERSION"
 fi
 
-VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
-
 printf "%s" "$VERSION"