X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=622a693c452337be48bbd546ed3b012137e70138;hp=89c56f4a03ccebab1cb8460321120ad72eca6982;hb=45247578146cd1c92c73d29c1ce8cd727d3cb6b3;hpb=7549caddb0e27d05f0be87c06bed3a0a97d98ebe diff --git a/grml-debootstrap b/grml-debootstrap index 89c56f4..622a693 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -389,7 +389,7 @@ fi # make sure we have what we need {{{ if [ -n "$VIRTUAL" ] ; then - check4progs grub-mkimage kpartx mksh parted qemu-img || bailout 1 + check4progs kpartx mksh parted qemu-img || bailout 1 fi # }}} @@ -1093,12 +1093,15 @@ finalize_vm() { bailout 1 fi - einfo "Installing Grub as bootloader." mount -t proc none "${MNTPOINT}"/proc mount -t sysfs none "${MNTPOINT}"/sys mount --bind /dev "${MNTPOINT}"/dev mount --bind /dev/pts "${MNTPOINT}"/dev/pts +# Has chroot-script installed GRUB to MBR using grub-install (successfully), already? +# 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." 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 @@ -1116,6 +1119,7 @@ finalize_vm() { chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2 dd if="${MNTPOINT}/tmp/core.img" of="${ORIG_TARGET}" conv=notrunc seek=4 rm -f "${MNTPOINT}/tmp/core.img" +fi einfo "Updating grub configuration file." if [ -n "$BOOT_APPEND" ] ; then @@ -1133,7 +1137,7 @@ finalize_vm() { umount "${MNTPOINT}"/proc umount "${MNTPOINT}"/sys umount "${MNTPOINT}"/dev/pts - umount "${MNTPOINT}"/dev + try_umount 3 "${MNTPOINT}"/dev umount "${MNTPOINT}" kpartx -d "${ORIG_TARGET}" >/dev/null }