VM feature: improve sed command line to replace root=... kernel option
authorMichael Prokop <mika@grml.org>
Sun, 13 May 2012 16:02:57 +0000 (18:02 +0200)
committerMichael Prokop <mika@grml.org>
Sun, 13 May 2012 16:02:57 +0000 (18:02 +0200)
Quoting bugreport:

| [...] I found an issue which renders
| every preconfigured BOOTPARAMS for vmfiles useless.
|
| Near the end of grml-debootstrap the grub config is changed to boot in
| virtual environments. Unfortunately the whole line is replaced to
| root=/dev/sda1 and each parameter that was previously set is gone by
| then.
|
| See attached a diff that just replaces the root device string.

Thanks: Conny Seidel <conny.seidel@amd.com> for bugreport + patch

grml-debootstrap

index a30deb9..2a6c683 100755 (executable)
@@ -1031,7 +1031,7 @@ finalize_vm() {
   einfo "Adjusting grub.cfg for successful boot sequence."
   # ugly but needed to boot grub acordingly
   sed -i "s;set root=.*;set root='(hd0,msdos1)';" "${MNTPOINT}"/boot/grub/grub.cfg
-  sed -i "s; root=/dev/.*; root=/dev/sda1;" "${MNTPOINT}"/boot/grub/grub.cfg
+  sed -i "s;root=[^ ]\+;root=/dev/sda1;" "${MNTPOINT}"/boot/grub/grub.cfg
 
   umount "${MNTPOINT}"
   kpartx -d "${ORIG_TARGET}" >/dev/null