From 341d7aaff7d71311d9b8d06e22237f3e6cbcdba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Thu, 27 Mar 2014 17:57:18 +0100 Subject: [PATCH] fix grub2 installation on Debian Wheezy --target has been introduced in grub2. This patch ensure we use the minimal version before adding the --target XXX flag. Debian Wheezy and Precise share the same limitation regarding the root device. Change-Id: I5b3ad42b9fb536d13fb65d84339bc15bc23d99a3 --- elements/vm/finalise.d/51-bootloader | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/elements/vm/finalise.d/51-bootloader b/elements/vm/finalise.d/51-bootloader index 75d01403..39bd1b63 100755 --- a/elements/vm/finalise.d/51-bootloader +++ b/elements/vm/finalise.d/51-bootloader @@ -88,7 +88,7 @@ function install_grub2 { # - --target=i386-pc is invalid for non-i386/amd64 architectures # - and for UEFI too. # GRUB_OPTS="$GRUB_OPTS --target=i386-pc" - if [[ ! $GRUB_OPTS == *--target* ]]; then + if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then # /sys/ comes from the host machine. If the host machine is using EFI # but the image being built doesn't have EFI boot-images installed we # should set the --target to use a BIOS-based boot-image. @@ -153,9 +153,7 @@ function install_grub2 { [ -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. + if [ $RELEASE = 'precise' ] || [ $RELEASE = 'wheezy' ]; then sed -i "s%search --no.*%%" $GRUB_CFG sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG fi