xref: /openwifi/user_space/sdrctl_src/version.sh (revision b73660ad79a69a37f3fe788f4f09f51e1255bab5)
1#!/bin/sh
2
3VERSION="3.17"
4OUT="$1"
5
6if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
7	git update-index --refresh --unmerged > /dev/null
8	descr=$(git describe)
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
18else
19	v="$VERSION"
20fi
21
22echo '#include "sdrctl.h"' > "$OUT"
23echo "const char sdrctl_version[] = \"$v\";" >> "$OUT"
24