]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - version.sh
bump version to 4.3
[thirdparty/iw.git] / version.sh
index 9126ef24b9b736447444be5166325425d47b0654..7ccd419ffc468b2806add4bfff43c325abb866a8 100755 (executable)
@@ -1,17 +1,23 @@
 #!/bin/sh
 
-VERSION="0.9"
+VERSION="4.3"
+OUT="$1"
 
-(
-echo "#define VERSION \"$VERSION\""
-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
        git update-index --refresh --unmerged > /dev/null
-       printf "#define IW_GIT_VERSION \"-g%.8s" "$head"
+       descr=$(git describe --match=v*)
+
+       # on git builds check that the version number above
+       # is correct...
+       [ "${descr%%-*}" = "v$VERSION" ] || exit 2
+
+       v="${descr#v}"
        if git diff-index --name-only HEAD | read dummy ; then
-               printf -- "-dirty"
+               v="$v"-dirty
        fi
-       echo '"'
 else
-       echo '#define IW_GIT_VERSION ""'
+       v="$VERSION"
 fi
-) > version.h
+
+echo '#include "iw.h"' > "$OUT"
+echo "const char iw_version[] = \"$v\";" >> "$OUT"