From 951c24dc08ac85d9f1d99fdb06780b1fd499affe Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel@debian.org>
Date: Mon, 26 Jan 2009 14:04:48 +0100
Subject: Adding temporary workaround to 'failed to install grub' error when
 using live-installer.

---
 helpers/lh_chroot_hacks | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks
index 2c97111..ad7a7fd 100755
--- a/helpers/lh_chroot_hacks
+++ b/helpers/lh_chroot_hacks
@@ -112,11 +112,28 @@ then
 	chown -R --quiet ${ID}:${ID} chroot/home/${LH_USERNAME}
 fi
 
-# This is a temporary hack to get rid of fstab;
-# needs cleanup in live-initramfs first to proper fix.
 if [ "${LH_DEBIAN_INSTALLER}" = "live" ]
 then
+	# This is a temporary hack to get rid of fstab;
+	# needs cleanup in live-initramfs first to proper fix.
 	rm -f chroot/etc/fstab
+
+	# There is a timing issue somewhere when using live-installer
+	# and the apt-get update waypoint: At the time when we're installing
+	# bootloader, it tries to fetch them from the net but the e.g.
+	# 'chroot /target apt-get install grub' fails because of missing
+	# packages lists. As a very cheap workaround, we ensure that the
+	# bootloader is already installed in the image. Very ugly, but it's to
+	# late to fix it in d-i because lenny rc2 has been already released.
+	case "${LH_ARCHITECTURE}" in
+		amd64|i386)
+			Apt install grub
+			;;
+
+		powerpc)
+			Apt install yaboot
+			;;
+	esac
 fi
 
 if [ "${LH_EXPOSED_ROOT}" = "enabled" ]
-- 
cgit v1.0