From 030d69585343f481a0c5e94e60507c9212c6fb91 Mon Sep 17 00:00:00 2001 From: okuji Date: Thu, 21 Jun 2001 23:15:02 +0000 Subject: [PATCH] Add `--with-configfile' into the commands "bootp" and "dhcp". --- ChangeLog | 8 ++++++++ NEWS | 3 +++ stage2/builtins.c | 25 +++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fc5286e7..812dec295 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-06-22 OKUJI Yoshinori + + From Thierry Laronde : + * stage2/builtins.c (configfile_func): Added a prototype. + (bootp_func): If `--with-configfile' is given, set + WITH_CONFIGFILE to one, and call configfile_func with + CONFIG_FILE. + 2001-06-21 OKUJI Yoshinori * docs/grub.texi: Update the location of the CVS repository diff --git a/NEWS b/NEWS index 6f1f68759..f327d510d 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,9 @@ New in 1.0 - XXXX-XX-XX: * Jump to the physical entry address of a Multiboot kernel when booting it up. The old behavior was to use the virtual one, regardless of the setting of the physical address. +* The commands "bootp" and "dhcp" accepts a new option + `--with-configfile', so that you can load a remotely specified + configuration file automatically, like the network boot images. New in 0.5.96 - 2000-10-04: * New commands, "reboot" and "halt". diff --git a/stage2/builtins.c b/stage2/builtins.c index a3b2267bb..e22fa50d3 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -80,6 +80,10 @@ int show_menu = 1; /* The BIOS drive map. */ static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1]; +/* Prototypes for allowing straightfoward calling of builtins functions + inside other functions. */ +static int configfile_func (char *arg, int flags); + /* Initialize the data for builtins. */ void init_builtins (void) @@ -349,6 +353,15 @@ static struct builtin builtin_boot = static int bootp_func (char *arg, int flags) { + int with_configfile = 0; + + if (grub_memcmp (arg, "--with-configfile", sizeof ("--with-configfile") - 1) + == 0) + { + with_configfile = 1; + arg = skip_to (0, arg); + } + if (! bootp ()) { if (errnum == ERR_NONE) @@ -359,6 +372,12 @@ bootp_func (char *arg, int flags) /* Notify the configuration. */ print_network_configuration (); + + /* XXX: this can cause an endless loop, but there is no easy way to + detect such a loop unfortunately. */ + if (with_configfile) + configfile_func (config_file, flags); + return 0; } @@ -367,8 +386,10 @@ static struct builtin builtin_bootp = "bootp", bootp_func, BUILTIN_CMDLINE | BUILTIN_MENU, - "bootp", - "Initialize a network device via BOOTP." + "bootp [--with-configfile]", + "Initialize a network device via BOOTP. If the option `--with-configfile'" + " is given, try to load a configuration file specified by the 150 vendor" + " tag." }; #endif /* SUPPORT_NETBOOT */