From f42f932bfcca306c1d53b49b2c51e2db08837ac4 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 4 Jun 2015 13:40:12 +0200 Subject: [PATCH] Ensure that grub-pc is installed in VMs even when using --nopackages We're always setting up GRUB as bootloader when installing a VM. If the --nopackages options is present the grub-pc package is missing inside the VM. Therefore ensure that the grub-pc is still present. Fixes #40 @ github --- grml-debootstrap | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grml-debootstrap b/grml-debootstrap index 104f454..7fd52a2 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1158,6 +1158,12 @@ finalize_vm() { # chroot-script skips installation for unset ${GRUB} if [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v | fgrep -q GRUB; then einfo "Installing Grub as bootloader." + + if ! chroot "${MNTPOINT}" dpkg --list grub-pc 2>/dev/null | grep -q '^ii' ; then + echo "Notice: grub-pc package not present yet, installing it therefore." + DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y install $DPKG_OPTIONS grub-pc + fi + mkdir -p "${MNTPOINT}/boot/grub" if ! [ -d "${MNTPOINT}"/usr/lib/grub/i386-pc/ ] ; then eerror "Error: grub not installed inside Virtual Machine. Can not install bootloader." ; eend 1 -- 2.1.4