]> rtime.felk.cvut.cz Git - jailhouse.git/blob - scripts/gen_version_h
scripts: deal with shell incompatibilities
[jailhouse.git] / scripts / gen_version_h
1 #!/bin/sh
2 #
3 # Jailhouse, a Linux-based partitioning hypervisor
4 #
5 # Copyright (c) Siemens AG, 2014
6 #
7 # Authors:
8 #  Jan Kiszka <jan.kiszka@siemens.com>
9 #
10 # This work is licensed under the terms of the GNU GPL, version 2.  See
11 # the COPYING file in the top-level directory.
12 #
13
14 echo "/* Auto-generated - leave alone and don't commit! */"
15 echo ""
16
17 if ! git rev-parse 2>/dev/null; then
18         version="`cat $1/VERSION`"
19 else
20         cd $1 > /dev/null
21         git diff > diff.log
22         describe="`git describe --long --dirty --match "v[0-9].[0-9]*"`"
23         version="`echo $describe | sed -e 's/\([^-]*\)-\(.*\)/\1 (\2)/'`"
24         cd - > /dev/null
25 fi
26
27 echo "#define JAILHOUSE_VERSION \"$version\""