grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax options for dynamic menu generation in grub-script


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: Syntax options for dynamic menu generation in grub-script
Date: Fri, 03 Sep 2010 14:22:40 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100805 Icedove/3.0.6

On 08/24/2010 08:03 AM, Jordan Uggla wrote:
> There has been some discussion recently on IRC about how to implement
> dynamic menu generation in grub-script, and I think the discussion is
> worth moving to the mailing list as whatever option we choose we will
> be stuck supporting for a long time to come.
>
> Dynamic menu generation basically means that "menuentry" will become a
> true command that can be executed from loops / conditional statements
> and that the resulting menu entry can be different depending on
> different circumstances. For instance, you could detect all GNU/Linux
> installations on a computer at boot and generate menu entries for
> every kernel image found, passing the detected UUID for the root=
> statement in the kernel parameters (see osdetect.cfg from bvk's
> osdetect bzr branch which does this as well as detecting other OSs).
>
> Two main options for the syntax of the menuentry command have been
> fleshed out so far:
>
> 1. In the first, menu entries act very similar to functions, passing
> variables like the kernel image path via positional parameters ( $1
> being the title of the menu entry ). As an example, here is how you
> could generate a menu for choosing among detected grub2 installations
> with this syntax:
>
> This is basically implemented right now.
>
>   
This is the way which makes sense to any C coder.
> 2. The other option would be to pass the source of the menu entry as a
> regular string, using normal shell syntax to construct this string. An
> implementation of the same example would be:
>
>
>
>   
This is a way which basically makes usage of eval-like interface.
Wouldn't eval program be enough to achieve this? Sth like:
eval "

  menuentry \"Load $core\" {
    root=$device
    multiboot $core
  }
"
It looks for me that the second approach is simply trying to solve 2 problems 
at the same time.
Actualy 2 interfaces aren't contradictory. We may have an additional command 
menuentry_eval for second interface and then we can let the coders decide.



-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]