forked from aircrack-ng/aircrack-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evalrev
executable file
·61 lines (50 loc) · 1.52 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
53
54
55
56
57
58
59
60
61
#!/bin/sh
set -euf
DIR=${1:-}
CMD=${2:-}
SCM=""
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)"
SCM="_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')"
SCM="_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')"
SCM="_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')"
SCM="_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"
SCM="_r1"
fi
else
REVISION="$(cat ${DIR}/VERSION)"
fi
if test "x$CMD" = "xscm"; then
echo $SCM
elif test "x$CMD" = "xquoted"; then
echo \"$REVISION\"
else
echo $REVISION
fi