2006-05-07 Yoshinori K. Okuji <okuji@enbug.org>
Use the environment context in the menu. Remove the commands "default" and "timeout", and use variables instead. * normal/menu.c: Include grub/env.h. (print_entry): Cast TITLE to silence gcc. (get_timeout): New function. (set_timeout): Likewise. (get_entry_number): Likewise. (run_menu): Use a default entry, a fallback entry and a timeout in the environment variables "default", "fallback" and "timeout". Also, tweak the default entry if it is not within the current menu entries. (grub_menu_run): Use a fallback entry in the environment variable "fallback". * normal/main.c (read_config_file): Do not initialize NEWMENU->DEFAULT_ENTRY, NEWMENU->FALLBACK_ENTRY or NEWMENU->TIMEOUT. (grub_normal_execute): Use a data slot to store the menu. * include/grub/normal.h (struct grub_menu): Removed default_entry, fallback_entry and timeout. (struct grub_menu_list): Removed. (grub_menu_list_t): Likewise. (struct grub_context): Likewise. (grub_context_t): Likewise. (grub_context_get): Likewise. (grub_context_get_current_menu): Likewise. (grub_context_push_menu): Likewise. (grub_context_pop_menu): Likewise. (grub_default_init): Likewise. (grub_default_fini): Likewise. (grub_timeout_init): Likewise. (grub_timeout_fini): Likewise. * conf/sparc64-ieee1275.rmk (pkgdata_MODULES): Removed default.mod and timeout.mod. (normal_mod_SOURCES): Removed normal/context.c. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Removed commands/default.c, commands/timeout.c and normal/context.c. (normal_mod_SOURCES): Removed normal/context.c. * conf/i386-pc.rmk (grub_emu_SOURCES): Removed commands/default.c, commands/timeout.c and normal/context.c. (normal_mod_SOURCES): Removed normal/context.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Removed commands/default.c, commands/timeout.c and normal/context.c. (normal_mod_SOURCES): Removed normal/context.c. * conf/common.rmk (pkgdata_MODULES): Removed default.mod and timeout.mod. (default_mod_SOURCES): Removed. (default_mod_CFLAGS): Likewise. (default_mod_LDFLAGS): Likewise. (timeout_mod_SOURCES): Removed. (timeout_mod_CFLAGS): Likewise. (timeout_mod_LDFLAGS): Likewise. * DISTLIST: Removed commands/default.c, commands/timeout.c and normal/context.c. * commands/default.c: Removed. * commands/timeout.c: Likewise. * normal/context.c: Likewise.
This commit is contained in:
parent
1eb9cc1da4
commit
4e93851c0f
18 changed files with 225 additions and 643 deletions
|
@ -1,57 +0,0 @@
|
|||
/* default.c - set the default boot entry */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/arg.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
/* This is a simple version. This should support a saved boot entry,
|
||||
a label, etc. */
|
||||
static grub_err_t
|
||||
grub_cmd_default (struct grub_arg_list *state __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_menu_t menu;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "entry number required");
|
||||
|
||||
menu = grub_context_get_current_menu ();
|
||||
if (menu)
|
||||
menu->default_entry = grub_strtoul (args[0], 0, 0);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GRUB_MOD_INIT(default)
|
||||
{
|
||||
(void)mod; /* To stop warning. */
|
||||
grub_register_command ("default", grub_cmd_default, GRUB_COMMAND_FLAG_MENU,
|
||||
"default ENTRY", "Set the default entry", 0);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(default)
|
||||
{
|
||||
grub_unregister_command ("default");
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/* timeout.c - set the timeout */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/arg.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_timeout (struct grub_arg_list *state __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_menu_t menu;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "timeout value required");
|
||||
|
||||
menu = grub_context_get_current_menu ();
|
||||
if (menu)
|
||||
menu->timeout = grub_strtoul (args[0], 0, 0);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GRUB_MOD_INIT(timeout)
|
||||
{
|
||||
(void)mod; /* To stop warning. */
|
||||
grub_register_command ("timeout", grub_cmd_timeout, GRUB_COMMAND_FLAG_MENU,
|
||||
"timeout SECS", "Set the timeout", 0);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(timeout)
|
||||
{
|
||||
grub_unregister_command ("timeout");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue