From: Johannes Berg Date: Tue, 16 Sep 2008 20:12:48 +0000 (+0200) Subject: add some version checking and stuff X-Git-Tag: v0.9^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2dc285b7b21e53b09a5738c8bc7ed5c1ab65d8d3;p=thirdparty%2Fiw.git add some version checking and stuff --- diff --git a/iw.c b/iw.c index 58d58f0..bbaba4d 100644 --- 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) diff --git a/version.sh b/version.sh index 9126ef2..f61b39a 100755 --- a/version.sh +++ b/version.sh @@ -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