All of lore.kernel.org
 help / color / mirror / Atom feed
* Idea: use menu hook to implement the savedefault command
@ 2008-08-11 21:03 Bean
  2008-08-11 21:32 ` Robert Millan
  2008-08-13 10:31 ` Marco Gerards
  0 siblings, 2 replies; 15+ messages in thread
From: Bean @ 2008-08-11 21:03 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

Now it's possible to implement savedefault with load_env and save_env,
but the problem is we need to add it to every menuitem, it's tedious
process, and new item don't get it automatically.

I'm thinking about using menu hook to solve this. I can think of two
implementation:

1. Function interface

We can install hooks, which get called just before the menu is invoked.

2. Script interface

We can use certain variable to specific the command to use, for example:

set MENU_PRELOAD=save_env default

The first menu is easier to implement, but the second one is more flexible.

btw, we can also use this to implement the password command. Just
before the menu is executed, we call the hook. If the password is not
match, we return false and it quit. But it's a little tricky this
time, as some item may not be protected. For this, we introduce
another concept, the attributes of an menu item. For example, we can
set an lock attribute that indicate that this item should be verified
for password. The attribute list is passed to the hook function, so
they can just lookup it's value and decide what to do.

Note that the attribute concept is already used in Colin's GSOC
project, it uses to specific the icon of a boot item, we just extent
it to include other attributes.

-- 
Bean

-- 
Bean



^ permalink raw reply	[flat|nested] 15+ messages in thread
* Idea: use menu hook to implement the savedefault command
@ 2008-08-11 21:02 Bean
  0 siblings, 0 replies; 15+ messages in thread
From: Bean @ 2008-08-11 21:02 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

Now it's possible to implement savedefault with load_env and save_env,
but the problem is we need to add it to every menuitem, it's tedious
process, and new item don't get it automatically.

I'm thinking about using menu hook to solve this. I can think of two
implementation:

1. Function interface

We can install hooks, which get called just before the menu is invoked.

2. Script interface

We can use certain variable to specific the command to use, for example:

set MENU_PRELOAD=save_env default

The first menu is easier to implement, but the second one is more flexible.

btw, we can also use this to implement the password command. Just
before the menu is executed, we call the hook. If the password is not
match, we return false and it quit. But it's a little tricky this
time, as some item may not be protected. For this, we introduce
another concept, the attributes of an menu item. For example, we can
set an lock attribute that indicate that this item should be verified
for password. The attribute list is passed to the hook function, so
they can just lookup it's value and decide what to do.

Note that the attribute concept is already used in Colin's GSOC
project, it uses to specific the icon of a boot item, we just extent
it to include other attributes.

-- 
Bean



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-08-13 12:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-11 21:03 Idea: use menu hook to implement the savedefault command Bean
2008-08-11 21:32 ` Robert Millan
2008-08-12  1:27   ` Bean
2008-08-12  8:52     ` Robert Millan
2008-08-12  9:38       ` Bean
2008-08-12 10:15         ` Robert Millan
2008-08-12 10:38           ` Bean
2008-08-12 10:44             ` Robert Millan
2008-08-12 10:52               ` Bean
2008-08-13 10:31 ` Marco Gerards
2008-08-13 11:36   ` Javier Martín
2008-08-13 11:48     ` Robert Millan
2008-08-13 12:11       ` Javier Martín
2008-08-13 12:38         ` Robert Millan
  -- strict thread matches above, loose matches on Subject: below --
2008-08-11 21:02 Bean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.