bugGNU GRUB - Bugs: bug #35663, GRUB 1.99 [PATCH]: Enhancements...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #35663: GRUB 1.99 [PATCH]: Enhancements and bug fixes

Submitter:  Andreas Vogel <anvoit>
Submitted:  Tue 28 Feb 2012 11:08:18 PM UTC
   
 
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  Invalid Privacy:  Public
Assigned to:  None Originator Name:  Andreas Vogel
Open/Closed:  Closed Release:  other
Release:  Reproducibility:  None
Planned Release:  None

Wed 29 Feb 2012 10:47:02 PM UTC, comment #3: 

Judging from you description it seems that it's a series of changes. As such it's probably possible to apply parts of it (especially bugfixes) separately from the rest.
Until freeze is over we can commit it into experimental.
I appreciate your work.
As for apparent lack of interest it's simply that I'm busy now and haven't had time to look through the patch. It's much easier to find time to review patches by small parts rather than all in one go.
Please move to -email is unavailable-

Vladimir Serbinenko <phcoder>
Group administrator
Wed 29 Feb 2012 10:35:54 PM UTC, comment #2: 

I'm new to your business so please excuse my level of dumbness.

1) The patch is too big?? Honestly, in order to have these new facility, the patch includes everything what is needed. Or do you want that i make a patch for every single file?

2) I understand that i have had bad luck that i came right at the date of code freeze. From what you write it's not clear what you expect me to do now. You know, I invested a lot of time to improve the menu system (especially the submenus) and i think it's really i great improvement. At least i would have expected to hear something substantial about if you are interested in these features at all. I'm willing to make all modifications again for the new release, but only if there is real interest. I don't wanna waste my time for stuff which you don't like to have.


Andreas Vogel <anvoit>
Wed 29 Feb 2012 06:27:25 PM UTC, comment #1: 

This isn't the right place to post patches, please use grub-devel@gnu.org. This patch is too big, please split it into smaller ones. Third, since we're in freeze no new feature will be accepted until after the release

Vladimir Serbinenko <phcoder>
Group administrator
Tue 28 Feb 2012 11:08:18 PM UTC, original submission:  

The following patch for GRUB 1.99 implements a bunch of enhancements and some bug fixes. The patch also creates a README file with the detailed description.

I hereby state that all code was written only by me and doesn't contain any work from others. The code in this patch may be used according to the GNU General public license version v3 or later.

I would be glad if you decide to take over this patch into GRUB 2.

This is the description for this patch:



Package:     GRUB 1.99
Patch:       grub-1.99-andreas_vogel_menu_and_subst.patch
Created:     28.2.2012
Author:      Andreas Vogel
Description:

This patch enhances GRUB 1.99 by the following features:

*) All changes made by this patch are supposed to be backward compatible.

*) New menuentry option -S | --silent=0|1 (hiding the terminal box)
   When a menuentry is a submenu or when a menuentry is created with the option --silent, then
   the terminal box is not shown when this menuentry is executed.

*) Reexecution of the menu definition after a menuentry execution
   After executing a menuentry and if the menu entry execution didn't end up with a booting action,
   the menu definition will be reexecuted before showing the menu again.
   The reason is to be able to have dynamic menus using the values of environment variables.

*) New menuentry option -l | --label=STRING
   When having dynamic menuentries (e.g. localized entry names), it's quite hard to
   set the 'default' variable to the entry title.
   Therefore with the new menuentry --label it is possible to specify the user visible title
   for a menuentry. If this option isn't set, the menuentry title will be used in order to maintain
   backward compatibility.

*) New menuentry option -H | --hidden=0|1
   If the --hidden option is set for a menuentry, the menuentry will not be visible. The
   activation of the menuentry is only possible by use of the key defined with --hotkey.

*) New menuentry option -E | --enable=0|1
   A disabled menuentry is shown but cannot be executed. In case the menuentry is a submenu, the
   submenu will not open if the menuentry is disabled.
   It's the responsibility of the output module to show an adequate representation of disabled
   menu entries.

*) Variable substitutions in strings
   This patch introduces a new general variable substitution function grub_subst() which sunstitutes
   environment variables in a string. The variable syntax is similar to BASH variable handling.
   Usage:
      $x or ${x}  expands to x
      ${x:-y}     expands to x if x is set and nonempty, otherwise expands to y
      ${x:=y}     expands to x if x is set and nonempty, otherwise expands to y and sets environment variable x
      ${x:+y}     expands to x if x is unset or empty, otherwise expands to y
   The use of single quotes and double quotes is supported. Single characaters may be escaped by backlash.

*) Enhanced hotkey aliases
   The list of possible hotkey aliases has been extended to cover all possible keys. Case is now
   insignificant when comparing key alias names.
   It is now possible to specify any combination of the SHIFT and CTRL modififiers. The order of the
   modifiers is irelevant.
   Examples:
      "F1" "<SHIFT> F1" "<CTRL> <SHIFT> F1"

*) Bug fix: normal/main.c: grub_normal_free_menu() didn't free all memory

*) Variable substitution for labels defined in theme for gfxmenu
   Using the new grub_subst() function, all labels in gfxmenu are subject to variable substitution.
   Therefore it's possible to create labels showing the value of an environment variable. As an example
   it would be now possible to create a themed debugging screen showing the values of the basic environment
   variables.

*) Variable substitution in view title defined in theme for gfxmenu

*) Variable substitutions for list entry names in gfxmenu and in text mode menu
   All menuentry titels/labels are subject to variable substition in order to be able to implement
   dynamic menue labels.
   As the menuentry definitions are created as shell functions, unquoted variables are already substituted
   when the command is executed. Therefore attention is needed because of quoting.
   Example:
       menuentry entry1 --silent 1 --label="Set gfxterm to 800x600 (current: $gfxterm)" {
           set gfxterm=800x600
       }

Open items:

*) The option parsing method implemented in lib/arg.c has IMHO a design problem.
   When defining an option which takes an optional argument by specifying GRUB_ARG_OPTION_OPTIONAL, there
   will be an ambiguity in a certain situation.
   Let's assume the option --silent is defined with the flag GRUB_ARG_OPTION_OPTIONAL and the type ARG_TYPE_INT.
   Given the command line:
       myprog --silent /dev/sda
   will fail because /dev/sda, which is meant to be just an argument to myprog, is treated to be the value for the
   --silent option.
   This is because the option parsing methods are able to handle both formats: '--silent=1' and '--silent 1'
   As a consequence, options taking an optional argument can only be used if they are followed either by another option
   or the string '--' which denotes the end of options. Although this is a working workaround I'm not sure
   if this is really the way it should be.

Summary:

This patch make it possible to implement customizable menus by using environment variables.
It is now possible to create customisation menus, e.g. to set the language, screen resolution,
custom boot options, etc. without the need to hardcode them into different menuentries.

Hidden menus are not shown on the screen and they are opened by hotkeys, e.g. to open the
settings menu tree or to open the help system menu tree.

Exported environment variables are not only exported into the environment of a menuentry execution
context, they are furthermore exported back into the callers environment. In other means exported environment
variables are global for the menu system.

Complete example:

##########################################################################
##  GRUB 1.99 configuration file
##########################################################################
set theme=$prefix/theme/theme.txt
set kbd=de
export kbd theme

menuentry linux --label "TEST: Boot linux (kbd=$kbd) [CTRL-b]" --hotkey '<CTRL> b' {
    echo
    echo "Booting linux with keyboard='$kbd'!"
    echo
    echo "Press <RETURN> to continue..."
    read
}

menuentry disabled --label "TEST: Disabled entry" --enable 0 {
    echo "Ooops! Why can we run a disabled menu entry??"
    echo "Press <RETURN> to continue..."
    read
}

function refresh_kbd_menulabels {
    set curLabel="(*)"
    if [ "$kbd" = de ] ; then set curDE=$curLabel ; else set curDE="" ; fi
    if [ "$kbd" = us ] ; then set curUS=$curLabel ; else set curUS="" ; fi
    set default="$kbd"
}

## Hidden settings menu... press CTRL-S to open it
submenu settings --label "TEST: Settings... [CTRL-s]" --hidden 1 --hotkey '<CTRL> s' {
    submenu keyboard --label 'TEST: Keyboard layout...' {
        refresh_kbd_menulabels

        menuentry de --label 'German keyboard $curDE' --silent 1 {
            set kbd=de
        }
        menuentry us --label 'English keyboard $curUS' --silent 1 {
            set kbd=us
        }
    }
}

##########################################################################
##  END of configuration file
##########################################################################

Andreas Vogel <anvoit>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #25209:  grub-1.99-andreas_vogel_menu_and_subst.patch added by anvoit (52KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by anvoit (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-02-29 phcoder StatusNone Invalid
        Open/ClosedOpen Closed
    2012-02-28 anvoit Attached File- Added grub-1.99-andreas_vogel_menu_and_subst.patch, #25209

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code