summaryrefslogtreecommitdiff
path: root/gen-id.sh
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-15 16:10:46 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-15 16:21:01 -0700
commit982211477ce6fe4e5ecaa1657be76df7a10dce08 (patch)
tree5eaac77a4c9923ccb2b328d2560e680597f3da23 /gen-id.sh
parentf50db05823739d6982afba17eeefa6bfa49b8523 (diff)
downloadsyslinux-982211477ce6fe4e5ecaa1657be76df7a10dce08.tar.gz
gen-id: only truncate tags starting with syslinux-<version>-
If git-describe comes up with a tag not starting with syslinux-<version>- then leave it as-is.
Diffstat (limited to 'gen-id.sh')
-rwxr-xr-xgen-id.sh32
1 files changed, 22 insertions, 10 deletions
diff --git a/gen-id.sh b/gen-id.sh
index c8f89793..1b3e108b 100755
--- a/gen-id.sh
+++ b/gen-id.sh
@@ -1,20 +1,32 @@
#!/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.
+# 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="$1"
if test -n "$GIT_DIR" -o -d ../.git -o -f ../.git; then
- ver="$(git describe | cut -d- -f3-)"
- if test -n "$ver"; 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
- ver="${ver}"\*
+ id="${id}"\*
fi
fi
fi
-if test -z "$ver"; then
- echo "$1"
-else
- echo "$ver"
+if test -z "$id"; then
+ id="$tim"
fi
+echo "$id"