Unbreak grub for precise.

Change-Id: I5739b95e08c25d732223ad36d00aa1a46f67ff28
This commit is contained in:
Robert Collins 2013-05-02 13:56:01 +12:00
parent 6dae56c452
commit f725be5dd1

View File

@ -22,11 +22,12 @@ fi
[ -n "$IMAGE_BLOCK_DEVICE" ]
PART_DEV=$IMAGE_BLOCK_DEVICE
BOOT_DEV=$(echo $IMAGE_BLOCK_DEVICE | sed -e 's/p1//')
GRUB_OPTS=${GRUB_OPTS:---modules="biosdisk part_msdos"}
if [ $DIB_RELEASE != 'precise' ]; then
GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
fi
$GRUBNAME "$GRUB_OPTS" $BOOT_DEV
GRUB_OPTS=${GRUB_OPTS:""}
# XXX: This is buggy:
# - --target=i386-pc is invalid for non-i386/amd64 architectures
# - and for UEFI too.
# GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV
# This might be better factored out into a per-distro 'install-bootblock'
# helper.
if [ -f "/boot/grub/grub.cfg" ] ; then
@ -34,7 +35,16 @@ if [ -f "/boot/grub/grub.cfg" ] ; then
elif [ -f "/boot/grub2/grub.cfg" ] ; then
GRUB_CFG=/boot/grub2/grub.cfg
fi
RELEASE=`lsb_release -cs`
[ -n "$RELEASE" ]
# grub-mkconfig generates a config with the device in it,
# This shouldn't be needed, but old code has bugs
if [ $RELEASE = 'precise' ] ; then
# Replace the search attempt with a hardcoded root as the Ubuntu reference
# images use.
sed -i "s%search --no.*%%" $GRUB_CFG
sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG
fi
# force use of a LABEL:
# NOTE: Updating the grub config by hand once deployed should work, its just
# prepping it in a different environment that needs fiddling.