grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] configfile


From: Hollis Blanchard
Subject: [patch] configfile
Date: Sun, 13 Feb 2005 09:18:51 -0600
User-agent: Mutt/1.5.6+20040907i

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  <address@hidden>

        * 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 <grub/normal.h>
+#include <grub/dl.h>
+#include <grub/arg.h>
+#include <grub/term.h>
+#include <grub/misc.h>
+
+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 */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]