forked from dosemu2/dosemu2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetversion
More file actions
executable file
·36 lines (33 loc) · 774 Bytes
/
Copy pathgetversion
File metadata and controls
executable file
·36 lines (33 loc) · 774 Bytes
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
#!/bin/sh
if test -d .git; then
# need -n 1 for merge commits
DATE=`git log HEAD^..HEAD -n 1 --format=%cd --date=short`
REV=`git rev-list HEAD ^dosemu-1.5.0 --count`
else
DATE=`date -r VERSION +%F`
REV=`tail -n 1 VERSION`
fi
if test "$1" = "-r"; then
echo "$REV"
exit 0
fi
if test "$1" = "-d"; then
echo "$DATE"
else
if test -d .git; then
DATE=`echo "$DATE" | sed -e 's/-//g'`
s=`git describe --tags --match "dosemu2-[0-9]*" HEAD 2>/dev/null | sed -e 's/^dosemu2-//' -e "s/-.\+-/-$DATE-/"`
fi
v1=`head -n 1 VERSION`
if test -z "$s"; then
s=$v1
else
v=`echo $s | cut -d - -f 1`
fi
if [ -n "$v" -a "$v" != "$v1" ]; then
echo "Update VERSION $v1 -> $v" >&2
echo $v > VERSION
echo "$REV" >> VERSION
fi
echo $s
fi