Run Nindent on com32/lib/sys/stdcon_read.c
[profile/ivi/syslinux.git] / gen-id.sh
1 #!/bin/sh
2 #
3 # Create a build ID for this build.  If we're using a git tree,
4 # generate an ID from "git describe", otherwise use the passed-in
5 # timestamp.
6 #
7 # Usage: gen-id.sh version timestamp
8 #
9
10 ver="$1"
11 tim="$1"
12
13 if test -n "$GIT_DIR" -o -d ../.git -o -f ../.git; then
14     id="$(git describe)"
15     if test -n "$id"; then
16         if test x"$(echo "$id" | cut -d- -f1)" = xsyslinux; then
17             id="$(echo "$id" | cut -d- -f2-)"
18             if test x"$(echo "$id" | cut -d- -f1)" = x"$ver"; then
19                 id="$(echo "$id" | cut -d- -f2-)"
20             fi
21         fi
22     fi
23     if test -n "$id"; then
24         if test -n "$(git diff-index --name-only HEAD)"; then
25             id="${id}"\*
26         fi
27     fi
28 fi
29 if test -z "$id"; then
30   id="$tim"
31 fi
32 echo "$id"