Basic menuentry-retrieveing jail

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-16 23:48:32 +02:00
parent cb731b5e81
commit 7756d44436
11 changed files with 115 additions and 30 deletions

View file

@ -27,28 +27,34 @@
static grub_err_t
grub_cmd_source (grub_command_t cmd, int argc, char **args)
{
int new_env;
int new_env, jail;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
new_env = (cmd->name[0] == 'c');
jail = (cmd->name[0] == 'j');
new_env = (cmd->name[jail ? 5 : 0] == 'c');
if (new_env)
{
grub_cls ();
grub_env_context_open (1);
}
grub_cls ();
if (new_env && !jail)
grub_env_context_open ();
if (jail)
grub_env_jail_open (!new_env);
grub_normal_execute (args[0], 1, ! new_env);
if (new_env)
if (new_env && !jail)
grub_env_context_close ();
if (jail)
grub_env_jail_close (!new_env);
return 0;
}
static grub_command_t cmd_configfile, cmd_source, cmd_dot;
static grub_command_t cmd_jail_source, cmd_jail_configfile;
GRUB_MOD_INIT(configfile)
{
@ -60,6 +66,19 @@ GRUB_MOD_INIT(configfile)
N_("FILE"),
N_("Load another config file without changing context.")
);
cmd_jail_source =
grub_register_command ("jail_source", grub_cmd_source,
N_("FILE"),
N_("Load another config file without changing context but take only menuentries.")
);
cmd_jail_configfile =
grub_register_command ("jail_configfile", grub_cmd_source,
N_("FILE"),
N_("Load another config file without changing context but take only menuentries.")
);
cmd_dot =
grub_register_command (".", grub_cmd_source,
N_("FILE"),
@ -71,5 +90,7 @@ GRUB_MOD_FINI(configfile)
{
grub_unregister_command (cmd_configfile);
grub_unregister_command (cmd_source);
grub_unregister_command (cmd_jail_configfile);
grub_unregister_command (cmd_jail_source);
grub_unregister_command (cmd_dot);
}