Generate static loopback.cfg configuration without depending on GRUB's regexp module
authorMichael Prokop <mika@grml.org>
Mon, 5 Mar 2012 14:16:56 +0000 (15:16 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 5 Mar 2012 14:36:12 +0000 (15:36 +0100)
The GRUB version provided by Debian/squeeze sadly doesn't support
the regexp module yet.  Therefore we can't use the file globbing
pattern to include configuration files.  So instead build a somewhat
more static loopback.cfg configuration file when generating the ISO.

grml-live
templates/boot/grub/grub.cfg
templates/boot/grub/header.cfg [new file with mode: 0644]

index 3a2301f..95f0b3e 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -899,6 +899,17 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
        fi
        cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
 
+       # generate loopback.cfg config file without depending on grub's regexp module
+       # which isn't available in Debian/squeeze
+       echo "## grub2 loopback configuration" > "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+       echo "source /boot/grub/header.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+       for config in "${BUILD_OUTPUT}"/boot/grub/*_default.cfg "${BUILD_OUTPUT}"/boot/grub/*_options.cfg ; do
+         [ -r "$config" ] || continue
+         echo "source ${config##$BUILD_OUTPUT}" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+       done
+       echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+       echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+
        # copy grub files from target
        cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.mod "${BUILD_OUTPUT}"/boot/grub/
        cp -a "${CHROOT_OUTPUT}"/usr/lib/grub/*-pc/*.o "${BUILD_OUTPUT}"/boot/grub/
index aba78da..40faccc 100644 (file)
@@ -1,29 +1,5 @@
 ## grub2 configuration
-set default=0
-set timeout=20
-
-if loadfont /boot/grub/ascii.pf2 ; then
-   insmod png
-   set gfxmode=auto
-   insmod gfxterm
-   insmod vbe
-   terminal_output gfxterm
-fi
-
-if [ -f /boot/grub/grml-theme/theme.txt ] ; then
-  set theme=/boot/grub/grml-theme/theme.txt
-  export theme
-else
-  set menu_color_normal=white/black
-  set menu_color_highlight=black/yellow
-  export menu_color_normal
-  export menu_color_highlight
-fi
-
-if [ ${iso_path} ] ; then
-    set loopback="findiso=${iso_path}"
-    export loopback
-fi
+source /boot/grub/header.cfg
 
 insmod regexp
 
diff --git a/templates/boot/grub/header.cfg b/templates/boot/grub/header.cfg
new file mode 100644 (file)
index 0000000..2b78bbc
--- /dev/null
@@ -0,0 +1,25 @@
+set default=0
+set timeout=20
+
+if loadfont /boot/grub/ascii.pf2 ; then
+   insmod png
+   set gfxmode=auto
+   insmod gfxterm
+   insmod vbe
+   terminal_output gfxterm
+fi
+
+if [ -f /boot/grub/grml-theme/theme.txt ] ; then
+  set theme=/boot/grub/grml-theme/theme.txt
+  export theme
+else
+  set menu_color_normal=white/black
+  set menu_color_highlight=black/yellow
+  export menu_color_normal
+  export menu_color_highlight
+fi
+
+if [ ${iso_path} ] ; then
+    set loopback="findiso=${iso_path}"
+    export loopback
+fi