forked from aircrack-ng/aircrack-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evalrev
executable file
·52 lines (42 loc) · 1.15 KB
/
evalrev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
set -euf
DIR=${1:-}
CMD=${2:-}
if [ x$DIR = "x" ]
then
DIR="."
fi
if test -d "${DIR}/.git"; then
#
# Locate the closest annotated tag
#
REVISION="$(git describe --abbrev=0 --tags 2>/dev/null || echo unknown)"
#
# Determine if we are a development branch, if so then append the
# short SHA1.
#
EXACTLY="$(git describe --abbrev=0 --tags --exact-match 2>/dev/null || echo)"
if test -z "$EXACTLY"; then
REVISION="${REVISION}_rev-$(git rev-parse --verify --short HEAD)"
fi
elif test -d "${DIR}/.svn"; then
REVISION="_r$(svnversion $DIR 2> /dev/null | sed 's/[^0-9]*//g')"
if test x$REVISION = "x"; then
REVISION="_r$(svn info $DIR 2> /dev/null | grep -i revision | sed 's/[^0-9]*//g')"
fi
if test x$REVISION = "x"; then
if test -f "${DIR}/.svn/entries"; then
REVISION="_r$(cat ${DIR}/.svn/entries | grep -i revision | head -n 1 | sed 's/[^0-9]*//g')"
fi
fi
if test x$REVISION = "x"; then
REVISION="_r1"
fi
else
REVISION="$(cat ${DIR}/VERSION)"
fi
if test "x$CMD" = "xquoted"; then
echo \"$REVISION\"
else
echo $REVISION
fi