File: gen-id.sh

package info (click to toggle)
syslinux 2:4.05+dfsg-6+deb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 25,684 kB
  • sloc: ansic: 276,159; asm: 9,973; pascal: 9,907; perl: 3,492; makefile: 1,736; sh: 626; python: 266; xml: 39
file content (33 lines) | stat: -rwxr-xr-x 754 bytes parent folder | download | duplicates (8)
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
#
# Create a build ID for this build.  If we're using a git tree,
# generate an ID from "git describe", otherwise use the passed-in
# timestamp.
#
# Usage: gen-id.sh version timestamp
#

ver="$1"
tim="$2"
top=`dirname "$0"`

if test -n "$GIT_DIR" -o -d "$top"/.git -o -f "$top"/.git; then
    id="$(git describe)"
    if test -n "$id"; then
	if test x"$(echo "$id" | cut -d- -f1)" = xsyslinux; then
            id="$(echo "$id" | cut -d- -f2-)"
            if test x"$(echo "$id" | cut -d- -f1)" = x"$ver"; then
		id="$(echo "$id" | cut -d- -f2-)"
            fi
        fi
    fi
    if test -n "$id"; then
	if test -n "$(git diff-index --name-only HEAD)"; then
	    id="${id}"\*
	fi
    fi
fi
if test -z "$id"; then
  id="$tim"
fi
echo "$id"