grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH]: Add GRUB_DISABLE_SUBMENU option
Date: Mon, 04 Nov 2013 00:14:50 +0100	[thread overview]
Message-ID: <5276D8EA.6050305@gmail.com> (raw)
In-Reply-To: <1359487413-14528-1-git-send-email-prarit@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 8560 bytes --]

I've committed a patch introducing the same option but more compact and
accepting GRUB_DISABLE_SUBMENU=n
On 29.01.2013 20:23, Prarit Bhargava wrote:
> I'm not sure what the proper patch posting protocol is on this list and
> I've never used bzr before.  If this is incorrect, please email me and let
> me know what I've done wrong.
> 
> Thanks,
> 
> P.
> 
> 
> 
> ------------------------------------------------------------
> revno: 4686
> committer: Prarit Bhargava <prarit@redhat.com>
> branch nick: grub
> timestamp: Tue 2013-01-29 14:14:01 -0500
> message:
>   Add GRUB_DISABLE_MENU option
>   
>   When doing kernel development it is often advantageous to do the following:
>   
>   1.  Select a kernel to boot with grub2-reboot
>   2.  Reboot, capture output from bad kernel.
>   3.  On subsequent reboot, boot known good or "default" kernel.
>   
>   The problem is that the submenus get in the way of doing this.  grub2-reboot
>   does not allow one to set a reboot to a specific kernel.
>   
>   I *could* write a rule to be executed on the existing grub.cfg to remove
>   the submenu entries, however, given that a google search for "grub2 remove
>   submenus" leads to many many hits, I think a better approach is to make
>   GRUB_DISABLE_SUBMENU a generally available option.
>   
>   Please note I have only tested this on Linux (specifically Fedora 17 and
>   Fedora 18).
>   
>   Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> 
> 
> diff:
> === modified file 'util/grub-mkconfig.in'
> --- util/grub-mkconfig.in	2012-12-28 07:21:17 +0000
> +++ util/grub-mkconfig.in	2013-01-29 19:14:01 +0000
> @@ -215,7 +215,8 @@
>    GRUB_INIT_TUNE \
>    GRUB_SAVEDEFAULT \
>    GRUB_ENABLE_CRYPTODISK \
> -  GRUB_BADRAM
> +  GRUB_BADRAM \
> +  GRUB_DISABLE_SUBMENU
>  
>  if test "x${grub_cfg}" != "x"; then
>    rm -f "${grub_cfg}.new"
> 
> === modified file 'util/grub.d/10_hurd.in'
> --- util/grub.d/10_hurd.in	2012-09-18 11:04:06 +0000
> +++ util/grub.d/10_hurd.in	2013-01-29 19:14:01 +0000
> @@ -156,14 +156,15 @@
>  for kernel in ${kernels}
>  do
>  
> -  if [ "x$is_first_entry" = xtrue ]; then
> +  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +    if [ "x$is_first_entry" = xtrue ]; then
>        hurd_entry "$kernel" simple
>        submenu_indentation="$grub_tab"
>      
>        # TRANSLATORS: %s is replaced with an OS name
>        echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnuhurd-advanced-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
> +    fi
>    fi
> -
>    hurd_entry "$kernel" advanced
>    hurd_entry "$kernel" recovery
>    is_first_entry=false
> @@ -171,8 +172,10 @@
>  
>  # 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 [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +  if [ x"$is_first_entry" != xtrue ]; then
> +    echo '}'
> +  fi
>  fi
>  
>  echo "$title_correction_code"
> 
> === modified file 'util/grub.d/10_kfreebsd.in'
> --- util/grub.d/10_kfreebsd.in	2013-01-03 22:19:19 +0000
> +++ util/grub.d/10_kfreebsd.in	2013-01-29 19:14:01 +0000
> @@ -211,15 +211,17 @@
>      module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
>    fi
>  
> -  if [ "x$is_first_entry" = xtrue ]; then
> -      kfreebsd_entry "${OS}" "${version}" simple
> -      submenu_indentation="$grub_tab"
> -    
> -      if [ -z "$boot_device_id" ]; then
> +  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +    if [ "x$is_first_entry" = xtrue ]; then
> +        kfreebsd_entry "${OS}" "${version}" simple
> +        submenu_indentation="$grub_tab"
> +
> +        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 'kfreebsd-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 'kfreebsd-advanced-$boot_device_id' {"
> +    fi
>    fi
>  
>    kfreebsd_entry "${OS}" "${version}" advanced
> @@ -233,8 +235,10 @@
>  
>  # 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 [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +  if [ x"$is_first_entry" != xtrue ]; then
> +    echo '}'
> +  fi
>  fi
>  
>  echo "$title_correction_code"
> 
> === modified file 'util/grub.d/10_linux.in'
> --- util/grub.d/10_linux.in	2012-09-18 11:04:06 +0000
> +++ util/grub.d/10_linux.in	2013-01-29 19:14:01 +0000
> @@ -226,18 +226,20 @@
>      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}"
> +  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +    if [ "x$is_first_entry" = xtrue ]; then
> +      linux_entry "${OS}" "${version}" simple \
> +      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
>  
> -    submenu_indentation="$grub_tab"
> +      submenu_indentation="$grub_tab"
>      
> -    if [ -z "$boot_device_id" ]; then
> -	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
> +      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
> +fi
>  
>    linux_entry "${OS}" "${version}" advanced \
>                "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
> @@ -252,8 +254,9 @@
>  
>  # 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 [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +  if [ x"$is_first_entry" != xtrue ]; then
> +    echo '}'
> +  fi
>  fi
> -
>  echo "$title_correction_code"
> 
> === modified file 'util/grub.d/10_netbsd.in'
> --- util/grub.d/10_netbsd.in	2012-10-28 10:55:22 +0000
> +++ util/grub.d/10_netbsd.in	2013-01-29 19:14:01 +0000
> @@ -157,15 +157,17 @@
>  
>    gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2
>  
> -  if [ "x$is_first_entry" = xtrue ]; then
> -      netbsd_entry "knetbsd"   "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
> -    submenu_indentation="$grub_tab"
> +  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +    if [ "x$is_first_entry" = xtrue ]; then
> +        netbsd_entry "knetbsd"   "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
> +      submenu_indentation="$grub_tab"
>      
> -    if [ -z "$boot_device_id" ]; then
> -	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
> +      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 'netbsd-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 'netbsd-advanced-$boot_device_id' {"
>    fi
>  
>    netbsd_entry "knetbsd"   "$k" advanced "${GRUB_CMDLINE_NETBSD_DEFAULT}"
> @@ -179,8 +181,10 @@
>  
>  # 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 [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
> +  if [ x"$is_first_entry" != xtrue ]; then
> +    echo '}'
> +  fi
>  fi
>  
>  echo "$title_correction_code"
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

  parent reply	other threads:[~2013-11-03 23:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 19:23 [PATCH]: Add GRUB_DISABLE_SUBMENU option Prarit Bhargava
2013-01-29 20:09 ` Andrey Borzenkov
2013-01-29 23:33   ` Prarit Bhargava
2013-01-30  5:00     ` Andrey Borzenkov
2013-01-30 13:39       ` Prarit Bhargava
2013-11-03 23:14 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-11-04 12:43   ` [PATCH] document GRUB_DISABLE_SUBMENU Andrey Borzenkov
2013-11-04 13:15     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-04 14:27       ` Andrey Borzenkov
2013-11-04 16:09         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-10 13:20           ` Andrey Borzenkov
2013-11-10 13:35             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-10 13:59               ` Barry Jackson
2013-11-10 14:38                 ` Andrey Borzenkov
2013-11-10 14:48                   ` Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5276D8EA.6050305@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).