forked from jordansissel/xdotool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.sh
executable file
·33 lines (29 loc) · 860 Bytes
/
version.sh
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
#!/bin/sh
if [ -r "VERSION" ] ; then
. ./VERSION
fi
if [ -z "$MAJOR" -o -z "$RELEASE" -o -z "$REVISION" ] ; then
MAJOR="3"
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
DATE_FMT="%Y%m%d"
RELEASE="$(date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT")"
REVISION=1
#$([ -d .svn ] && svn info . | awk '/Revision:/ {print $2}')
: ${REVISION=:0}
fi
VERSION="$MAJOR.$RELEASE.$REVISION"
case $1 in
--major) echo "$MAJOR" ;;
--header)
echo "#ifndef _VERSION_H_"
echo "#define _VERSION_H_"
echo "static const char *XDO_VERSION = \"$VERSION\";"
echo "#endif /* ifndef _VERSION_H */"
;;
--shell)
echo "MAJOR=\"$MAJOR\""
echo "RELEASE=\"$RELEASE\""
echo "REVISION=\"$REVISION\""
;;
*) echo "$VERSION" ;;
esac