great, grub in debian now has the same submenu brain-damage that Ubuntu
got last year.

amongst other problems, it breaks grub-set-default and grub-reboot,
because the submenu entry messes up the numerical ordering of the
menuentries.

anyway, here's a patch. allows users to choose whether 10_linux
generates submenus or not (by setting GRUB_ENABLE_SUBMENUS=true or false
in /etc/default/grub)

patch attached.

the patch as written defaults to disabling submenus. to retain current
(imo, broken) behaviour as default, change the tests from

  if [ "$GRUB_ENABLE_SUBMENUS" = "true" ]
to
  if [ "$GRUB_ENABLE_SUBMENUS" != "false" ]



i honestly don't care what the default is, as long as there's a setting
to enable/disable generation of submenus.

craig

-- 
craig sanders <c...@taz.net.au>
--- 10_linux.orig	2013-05-09 21:08:00.000000000 +1000
+++ 10_linux	2013-05-13 12:59:48.639018494 +1000
@@ -246,17 +246,19 @@
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
-  if [ "x$is_first_entry" = xtrue ]; then
-    linux_entry "${OS}" "${version}" simple \
-    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
-
-    submenu_indentation="\t"
-    
-    if [ -z "$boot_device_id" ]; then
-	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+  if [ "$GRUB_ENABLE_SUBMENUS" = "true" ] ; then 
+    if [ "x$is_first_entry" = xtrue ]; then
+      linux_entry "${OS}" "${version}" simple \
+      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+  
+      submenu_indentation="\t"
+      
+      if [ -z "$boot_device_id" ]; then
+        boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+      fi
+      # TRANSLATORS: %s is replaced with an OS name
+      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
     fi
-    # TRANSLATORS: %s is replaced with an OS name
-    echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
   fi
 
   linux_entry "${OS}" "${version}" advanced \
@@ -275,10 +277,12 @@
   is_first_entry=false
 done
 
-# If at least one kernel was found, then we need to
-# add a closing '}' for the submenu command.
-if [ x"$is_first_entry" != xtrue ]; then
-  echo '}'
+if [ "$GRUB_ENABLE_SUBMENUS" = "true" ] ; then 
+  # If at least one kernel was found, then we need to
+  # add a closing '}' for the submenu command.
+  if [ x"$is_first_entry" != xtrue ]; then
+    echo '}'
+  fi
 fi
 
 echo "$title_correction_code"

Reply via email to