Fix jumping back from the bsd4grml loader (ldbsd.com) to GNU GRUB
authorThorsten Glaser <tg@mirbsd.org>
Thu, 4 Jun 2009 15:56:39 +0000 (17:56 +0200)
committerMichael Prokop <mika@grml.org>
Sat, 13 Jun 2009 08:58:30 +0000 (10:58 +0200)
Formerly, we hard-coded jumping to either grub1 (grub-legacy) or
grub2 in the menu option #6, and offered the macros “grub1” and
“grub2” in boot.cfg (the text mode boot prompt / ldbsd.com command
line), with an alias from “grml” to “grub2” (normally).

Now we use the grml-live framework to patching the ldbsd.com con-
figuration files at image creation time to allow for either grub2,
grub1 with stage2, or grub1 with stage2_eltorito to be found.

Note that grub2 will be taken as default iff it exists, because
it supports manifold-boot™ images, which grub-legacy doesn’t.

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
grml-live
templates/boot/addons/bsd4grml/boot.6
templates/boot/addons/bsd4grml/boot.cfg

index 150615b..17222ba 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -625,6 +625,27 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       sed -i "s/%GRML_NAME_SQUASHFS%/$GRML_NAME_SQUASHFS/" "$BUILD_OUTPUT"/boot/isolinux/f4
       sed -i "s/%GRML_NAME_SQUASHFS%/$GRML_NAME_SQUASHFS/" "$BUILD_OUTPUT"/boot/isolinux/f5
 
+      # jump back to grub from bsd4grml:
+      if [ -e "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 ]; then
+         if [ -e "$BUILD_OUTPUT"/boot/grub/core.img ]; then
+            GRUB_VERSION=2
+         else
+            GRUB_VERSION=1
+         fi
+         if [ -e "$BUILD_OUTPUT"/boot/grub/stage2 ]; then
+            GRUB_LEGACY=stage2
+         else
+            GRUB_LEGACY=stage2_eltorito
+         fi
+
+         # why not ed(1)?
+         for file in "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 \
+                     "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.cfg; do
+             sed -i -e "s!%GRUB_VERSION%!$GRUB_VERSION!g" \
+                    -e "s!%GRUB_LEGACY%!$GRUB_LEGACY!g" "$file"
+         done
+      fi
+
       # autostart for Windows:
       if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
          cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/
index c1f6d9b..6131727 100644 (file)
@@ -1,8 +1,6 @@
-#echo
-#echo Switching to GNU GRUB-legacy
-#echo
-#machine exec grub /boot/grub/stage2
 echo
-echo Switching to GNU GRUB 2
+echo Switching to GNU GRUB %GRUB_VERSION%
 echo
-machine exec grub /boot/grub/core.img
+macro grub1 machine exec grub /boot/grub/%GRUB_LEGACY%
+macro grub2 machine exec grub /boot/grub/core.img
+grub%GRUB_VERSION%
index 7030d00..d121c65 100644 (file)
@@ -1,9 +1,8 @@
 set image /boot/addons/bsd4grml/bsd.rd
 set timeout 12
-#macro grml machine exec grub /boot/grub/stage2_eltorito
-macro grml machine exec grub /boot/grub/core.img
-macro grub1 machine exec grub /boot/grub/stage2
+macro grub1 machine exec grub /boot/grub/%GRUB_LEGACY%
 macro grub2 machine exec grub /boot/grub/core.img
+macro grml grub%GRUB_VERSION%
 echo
 echo ==================================================================
 echo # MirOS BSD #10-current [grml] | (c) 2002-2009 The MirOS Project #