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>
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
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"/
# autostart for Windows:
if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/
-#echo
-#echo Switching to GNU GRUB-legacy
-#echo
-#machine exec grub /boot/grub/stage2
-echo Switching to GNU GRUB 2
+echo Switching to GNU GRUB %GRUB_VERSION%
-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%
set image /boot/addons/bsd4grml/bsd.rd
set timeout 12
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 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 #
echo
echo ==================================================================
echo # MirOS BSD #10-current [grml] | (c) 2002-2009 The MirOS Project #