projects
/
grml-debootstrap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1adbe33
)
Install GRUB once, at most (second take, issue #78)
author
Sebastian Pipping
<sebastian@pipping.org>
Wed, 6 May 2015 16:56:46 +0000
(18:56 +0200)
committer
Michael Prokop
<mika@grml.org>
Fri, 8 May 2015 12:04:43 +0000
(14:04 +0200)
grml-debootstrap
patch
|
blob
|
history
diff --git
a/grml-debootstrap
b/grml-debootstrap
index
f218f7c
..
622a693
100755
(executable)
--- a/
grml-debootstrap
+++ b/
grml-debootstrap
@@
-1093,12
+1093,15
@@
finalize_vm() {
bailout 1
fi
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
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
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"
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
einfo "Updating grub configuration file."
if [ -n "$BOOT_APPEND" ] ; then