root/gen-id.sh

Revision 459a865ecfd949e7819c7674d3b450a1d1182d05, 0.7 KB (checked in by H. Peter Anvin <hpa@…>, 2 years ago)

sysdump: *actually* generate the proper version string

Make the gen-id.sh script actually do the right thing...

Signed-off-by: H. Peter Anvin <hpa@…>

  • Property mode set to 100755
Line 
1#!/bin/sh
2#
3# Create a build ID for this build.  If we're using a git tree,
4# generate an ID from "git describe", otherwise use the passed-in
5# timestamp.
6#
7# Usage: gen-id.sh version timestamp
8#
9
10ver="$1"
11tim="$2"
12top=`dirname "$0"`
13
14if test -n "$GIT_DIR" -o -d "$top"/.git -o -f "$top"/.git; then
15    id="$(git describe)"
16    if test -n "$id"; then
17        if test x"$(echo "$id" | cut -d- -f1)" = xsyslinux; then
18            id="$(echo "$id" | cut -d- -f2-)"
19            if test x"$(echo "$id" | cut -d- -f1)" = x"$ver"; then
20                id="$(echo "$id" | cut -d- -f2-)"
21            fi
22        fi
23    fi
24    if test -n "$id"; then
25        if test -n "$(git diff-index --name-only HEAD)"; then
26            id="${id}"\*
27        fi
28    fi
29fi
30if test -z "$id"; then
31  id="$tim"
32fi
33echo "$id"
Note: See TracBrowser for help on using the browser.