1 #!/bin/sh 2 3 VERSION="4.1" 4 OUT="$1" 5 6 if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then 7 git update-index --refresh --unmerged > /dev/null 8 descr=$(git describe --match=v*) 9 10 # on git builds check that the version number above 11 # is correct... 12 [ "${descr%%-*}" = "v$VERSION" ] || exit 2 13 14 v="${descr#v}" 15 if git diff-index --name-only HEAD | read dummy ; then 16 v="$v"-dirty 17 fi 18 else 19 v="$VERSION" 20 fi 21 22 echo '#include "iw.h"' > "$OUT" 23 echo "const char iw_version[] = \"$v\";" >> "$OUT" 24