summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/gen-id.sh
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-10-25 16:53:54 +0200
committerSebastian Schmelzer2010-10-25 16:53:54 +0200
commit3050a9253437f4a4b5ad4bf3b3efdc3c660a5137 (patch)
tree91ac22153e416aac7ca20916b314b5e2ffa871b1 /contrib/syslinux-4.02/gen-id.sh
downloadpreboot-3050a9253437f4a4b5ad4bf3b3efdc3c660a5137.tar.gz
preboot-3050a9253437f4a4b5ad4bf3b3efdc3c660a5137.tar.xz
preboot-3050a9253437f4a4b5ad4bf3b3efdc3c660a5137.zip
initial import of sc2010 scripts ..HEADmaster
Diffstat (limited to 'contrib/syslinux-4.02/gen-id.sh')
-rwxr-xr-xcontrib/syslinux-4.02/gen-id.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/contrib/syslinux-4.02/gen-id.sh b/contrib/syslinux-4.02/gen-id.sh
new file mode 100755
index 0000000..301ea4e
--- /dev/null
+++ b/contrib/syslinux-4.02/gen-id.sh
@@ -0,0 +1,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"