From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1D0M8k-0007xc-VM for mharc-grub-devel@gnu.org; Sun, 13 Feb 2005 10:58:31 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D0M8f-0007tu-90 for grub-devel@gnu.org; Sun, 13 Feb 2005 10:58:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D0M8Y-0007rh-Qb for grub-devel@gnu.org; Sun, 13 Feb 2005 10:58:19 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D0M8Y-0007rd-Hv for grub-devel@gnu.org; Sun, 13 Feb 2005 10:58:18 -0500 Received: from [207.217.121.252] (helo=pop-a065d14.pas.sa.earthlink.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D0Lv2-0006c6-QW for grub-devel@gnu.org; Sun, 13 Feb 2005 10:44:21 -0500 Received: from user-0vvde2g.cable.mindspring.com ([63.246.184.80] helo=miracle) by pop-a065d14.pas.sa.earthlink.net with esmtp (Exim 3.33 #1) id 1D0Lv1-0005Mz-00 for grub-devel@gnu.org; Sun, 13 Feb 2005 07:44:19 -0800 Received: from hollis by miracle with local (Exim 3.36 #1 (Debian)) id 1D0LWO-00013W-00 for ; Sun, 13 Feb 2005 09:18:52 -0600 Date: Sun, 13 Feb 2005 09:18:51 -0600 To: grub-devel@gnu.org Message-ID: <20050213151851.GA4056@miracle> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6+20040907i From: Hollis Blanchard Subject: [patch] configfile X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2005 15:58:28 -0000 While working on setting prefix correctly, I found it useful to have the `configfile' command like GRUB Legacy. I haven't tested on i386. I'm not sure about the `nested' parameter to grub_normal_execute, but this code seems to be working fine. 2005-02-13 Hollis Blanchard * conf/i386-pc.rmk (pkgdata_MODULES): Add configfile.mod. * conf/powerpc-ieee1275.rmk (pkgdata_MODULES): Likewise. * commands/configfile.mod: New file. Index: conf/i386-pc.rmk =================================================================== RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v retrieving revision 1.25 diff -u -p -r1.25 i386-pc.rmk --- conf/i386-pc.rmk 31 Jan 2005 21:40:25 -0000 1.25 +++ conf/i386-pc.rmk 13 Feb 2005 15:39:37 -0000 @@ -84,7 +84,8 @@ genmoddep_SOURCES = util/genmoddep.c pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \ hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \ boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \ - amiga.mod apple.mod pc.mod loopback.mod reboot.mod halt.mod help.mod + amiga.mod apple.mod pc.mod loopback.mod reboot.mod halt.mod help.mod \ + configfile.mod # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c Index: conf/powerpc-ieee1275.rmk =================================================================== RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v retrieving revision 1.23 diff -u -p -r1.23 powerpc-ieee1275.rmk --- conf/powerpc-ieee1275.rmk 31 Jan 2005 21:40:25 -0000 1.23 +++ conf/powerpc-ieee1275.rmk 13 Feb 2005 15:39:37 -0000 @@ -65,7 +65,8 @@ genmoddep_SOURCES = util/genmoddep.c pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \ hfs.mod jfs.mod normal.mod hello.mod font.mod \ boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \ - pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod + pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod \ + configfile.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c --- /dev/null 2004-12-18 12:15:49.000000000 -0600 +++ commands/configfile.c 2005-02-13 09:11:41.166390400 -0600 @@ -0,0 +1,69 @@ +/* configfile.c - command to manually load config file */ +/* + * 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 +#include +#include +#include +#include + +static grub_err_t +grub_cmd_configfile (struct grub_arg_list *state __attribute__ ((unused)), + int argc, char **args) + +{ + if (argc != 1) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required"); + + grub_cls (); + grub_normal_execute (args[0], 1); + + return 0; +} + + +#ifdef GRUB_UTIL +void +grub_configfile_init (void) +{ + grub_register_command ("configfile", grub_cmd_configfile, + GRUB_COMMAND_FLAG_BOTH, "configfile FILE", + "Load config file", 0); +} + +void +grub_configfile_fini (void) +{ + grub_unregister_command ("configfile"); +} +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT +{ + (void)mod; /* To stop warning. */ + grub_register_command ("configfile", grub_cmd_configfile, + GRUB_COMMAND_FLAG_BOTH, "configfile FILE", + "Load config file", 0); +} + +GRUB_MOD_FINI +{ + grub_unregister_command ("configfile"); +} +#endif /* ! GRUB_UTIL */