Use "git describe" in generating build signatures
[profile/ivi/syslinux.git] / gen-id.sh
1 #!/bin/sh
2 #
3 # Create a 10-character ID for this build.  If we're using a git tree,
4 # generate an ID of the form g[-*]XXXXXXXX (* = modified); otherwise use
5 # the passed-in timestamp.
6 #
7
8 if test -n "$GIT_DIR" -o -d ../.git -o -f ../.git; then
9     ver="$(git describe | cut -d- -f3-)"
10     if test -n "$ver"; then
11         if test -n "$(git diff-index --name-only HEAD)"; then
12             ver="${ver}"\*
13         fi
14     fi
15 fi
16 if test -z "$ver"; then
17   echo "$1"
18 else
19   echo "$ver"
20 fi