git ssb

0+

cel / sslh



Tree: 21f524f71165538dcde9f8de32b9f69385ba0c87

Files: 21f524f71165538dcde9f8de32b9f69385ba0c87 / genver.sh

1450 bytesRaw
1#! /bin/sh
2
3if [ ${#} -eq 1 ] && [ "x$1" = "x-r" ]; then
4 # release text only
5 QUIET=1
6else
7 QUIET=0
8fi
9
10if ! `(git status | grep -q "On branch") 2> /dev/null`; then
11 # If we don't have git, we can't work out what
12 # version this is. It must have been downloaded as a
13 # zip file.
14
15 # If downloaded from the release page, the directory
16 # has the version number.
17 release=`pwd | sed s/.*sslh-// | grep "[[:digit:]]"`
18
19 if [ "x$release" = "x" ]; then
20 # If downloaded from the head, Github creates the
21 # zip file with all files dated from the last
22 # change: use the Makefile's modification time as a
23 # release number
24 release=head-`perl -MPOSIX -e 'print strftime "%Y-%m-%d",localtime((stat "Makefile")[9])'`
25 fi
26fi
27
28if head=`git rev-parse --verify HEAD 2>/dev/null`; then
29 # generate the version info based on the tag
30 release=`(git describe --tags || git --describe || git describe --all --long) \
31 2>/dev/null | tr -d '\n'`
32
33 # Are there uncommitted changes?
34 git update-index --refresh --unmerged > /dev/null
35 if git diff-index --name-only HEAD | grep -v "^scripts/package" \
36 | read dummy; then
37 release="$release-dirty"
38 fi
39fi
40
41
42if [ $QUIET -ne 1 ]; then
43 printf "#ifndef VERSION_H \n"
44 printf "#define VERSION_H \n\n"
45 printf "#define VERSION \"$release\"\n"
46 printf "#endif\n"
47else
48 printf "$release\n"
49fi
50

Built with git-ssb-web