aboutsummaryrefslogtreecommitdiffstats
path: root/gen-id.sh
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-07 15:32:21 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-07 15:32:21 -0700
commit852d962ee2d0a51bf7aa3c6f0b1fdecbef1a3efd (patch)
tree1fd82e3dcc96b5049ae7f47ca2ed3df0ac3d93a7 /gen-id.sh
parent07ff8e874b0bd1d1c4fa893c94063fbedf6e3315 (diff)
downloadsyslinux-elf-852d962ee2d0a51bf7aa3c6f0b1fdecbef1a3efd.tar.gz
syslinux-elf-852d962ee2d0a51bf7aa3c6f0b1fdecbef1a3efd.tar.xz
syslinux-elf-852d962ee2d0a51bf7aa3c6f0b1fdecbef1a3efd.zip
Share the gen-id stuff between core and memdisk
Both core and memdisk wants to use the gen-id stuff, so let it.
Diffstat (limited to 'gen-id.sh')
-rwxr-xr-xgen-id.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/gen-id.sh b/gen-id.sh
new file mode 100755
index 00000000..02be21a4
--- /dev/null
+++ b/gen-id.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Create a 10-character ID for this build. If we're using a git tree,
+# generate an ID of the form g[-*]XXXXXXXX (* = modified); otherwise use
+# the passed-in timestamp.
+#
+
+if test -n "$GIT_DIR" -o -d ../.git -o -f ../.git; then
+ ver="$(git rev-parse HEAD | cut -c1-8)"
+ if test -n "$ver"; then
+ if test -n "$(git diff-index --name-only HEAD)"; then
+ ver='g*'"$ver"
+ else
+ ver='g-'"$ver"
+ fi
+ fi
+fi
+if test -z "$ver"; then
+ echo "$1"
+else
+ echo "$ver"
+fi