capt_get_packet(): check for key press only every 20ms
[iptraf-ng.git] / GEN-VERSION-FILE
bloba3e59fc2900cce1f3c927efaf9d094479c0feae5
1 #!/bin/bash
3 GVF=VERSION-FILE
4 DEF_VER=1.1.4
5 LF='
8 # First see if there is a version file (included in release tarballs),
9 # then try git-describe, then default.
10 if test -f version
11 then
12 VN=$(cat version) || VN="$DEF_VER"
13 elif test -d .git -o -f .git &&
14 VN=$(git describe --tags --match "[0-9]*" --abbrev=4 HEAD 2>/dev/null) &&
15 case "$VN" in
16 *$LF*) (exit 1) ;;
17 [0-9]*)
18 git update-index -q --refresh
19 test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty"
20 esac
21 then
22 VN=$(echo "$VN" | sed -e 's/-/./g');
23 else
24 VN="$DEF_VER"
28 VN=$(expr "$VN" : v*'\(.*\)')
30 if test -r $GVF
31 then
32 VC=$(sed -e 's/^IPTRAF_VERSION = //' <$GVF)
33 else
34 VC=unset
36 test "$VN" = "$VC" || {
37 echo >&2 "IPTRAF_VERSION = $VN"
38 echo "IPTRAF_VERSION = $VN" >$GVF