]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
add some version checking and stuff v0.9
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 16 Sep 2008 20:12:48 +0000 (22:12 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Tue, 16 Sep 2008 20:12:48 +0000 (22:12 +0200)
iw.c
version.sh

diff --git a/iw.c b/iw.c
index 58d58f008283624873a11098a4e68d50c9d79093..bbaba4d87186e6010f774b5e257e20a8ae20d627 100644 (file)
--- a/iw.c
+++ b/iw.c
@@ -105,7 +105,7 @@ static void usage(const char *argv0)
 
 static void version(void)
 {
-       printf("iw version " VERSION IW_GIT_VERSION "\n");
+       printf("iw version " IW_VERSION "\n");
 }
 
 static int phy_lookup(char *name)
index 9126ef24b9b736447444be5166325425d47b0654..f61b39af427fe469c2b9430fa8cabf2646f1d6fd 100755 (executable)
@@ -1,17 +1,23 @@
-#!/bin/sh
+#!/bin/bash
 
 VERSION="0.9"
 
 (
-echo "#define VERSION \"$VERSION\""
 if 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)
+
+       # on git builds check that the version number above
+       # is correct...
+       [ "${descr/-*/}" == "v$VERSION" ] || exit 2
+       
+       echo -n '#define IW_VERSION "'
+       echo -n "${descr:1}"
        if git diff-index --name-only HEAD | read dummy ; then
-               printf -- "-dirty"
+               echo -n "-dirty"
        fi
        echo '"'
 else
-       echo '#define IW_GIT_VERSION ""'
+echo "#define IW_VERSION \"$VERSION\""
 fi
 ) > version.h