mkboot: include git id in image name if available.

This commit is contained in:
Ben Gras 2010-11-25 15:25:17 +00:00
parent 5e1e763506
commit d1cfc50811

View file

@ -64,33 +64,33 @@ hdboot)
sh tell_config OS_RELEASE . OS_VERSION >/tmp/mkb.$$ sh tell_config OS_RELEASE . OS_VERSION >/tmp/mkb.$$
version=`sed 's/[" ]//g;/^$/d' </tmp/mkb.$$` version=`sed 's/[" ]//g;/^$/d' </tmp/mkb.$$`
# Retrieve the git revision; this only succeeds
# if git is available, it's a git checkout, *and*
# there are no uncommitted changes.
if git diff --quiet 2>/dev/null
then gitrev="-`git describe --always`"
fi
revision=`cat revision 2>/dev/null` revision=`cat revision 2>/dev/null`
if [ -z "$revision" ] if [ -z "$revision" ]
then rrevision="" then rrevision=""
gitrev=""
else rrevision=r$revision else rrevision=r$revision
fi fi
oldrev=$revision oldrev=$revision
target="${version}r${revision}"
if [ -z "$revision" ] if [ -z "$revision" ]
then then
revision=0 revision=0
rrevision="" rrevision=""
elif [ -f $rootdir/boot/image/$target ] else
then
if [ $rootdir/boot/image/$target -newer image ]
then
echo "$root:/boot/image/$target is up to date"
test $realroot != $root && umount $root
exit 0
fi
revision=`expr $revision + 1` revision=`expr $revision + 1`
rrevision=r$revision rrevision=r$revision
fi fi
target="${version}${rrevision}"
target="${version}${rrevision}${gitrev}"
set -- `ls -t $rootdir/boot/image` set -- `ls -t $rootdir/boot/image`