All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Filename default for grub-editenv
@ 2009-09-01 16:19 Colin Watson
  2009-09-03 14:16 ` Robert Millan
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2009-09-01 16:19 UTC (permalink / raw)
  To: grub-devel

(Per a discussion with Robert on IRC, this can be post-1.97 if you
like.)

Would it make sense for grub-editenv to have a default for the filename?
I dislike hardcoding something in package maintainer scripts that needs
to match a #define. The interface would be a little awkward since it's
grub-editenv FILENAME COMMAND, but we could just say that if you provide
only one argument then we use the default filename.

Index: util/grub-editenv.c
===================================================================
--- util/grub-editenv.c	(revision 2556)
+++ util/grub-editenv.c	(working copy)
@@ -72,7 +72,7 @@
     fprintf (stderr, "Try ``grub-editenv --help'' for more information.\n");
   else
     printf ("\
-Usage: grub-editenv [OPTIONS] FILENAME COMMAND\n\
+Usage: grub-editenv [OPTIONS] [FILENAME] COMMAND\n\
 \n\
 Tool to edit environment block.\n\
 \nCommands:\n\
@@ -85,7 +85,10 @@
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
 \n\
-Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
+If not given explicitly, FILENAME defaults to %s.\n\
+\n\
+Report bugs to <%s>.\n",
+DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG, PACKAGE_BUGREPORT);
 
   exit (status);
 }
@@ -282,13 +285,15 @@
 
   if (optind + 1 >= argc)
     {
-      fprintf (stderr, "no command specified\n");
-      usage (1);
+      filename = DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG;
+      command = argv[optind];
     }
+  else
+    {
+      filename = argv[optind];
+      command = argv[optind + 1];
+    }
 
-  filename = argv[optind];
-  command = argv[optind + 1];
-
   if (strcmp (command, "create") == 0)
     create_envblk_file (filename);
   else if (strcmp (command, "list") == 0)

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Filename default for grub-editenv
  2009-09-01 16:19 [PATCH] Filename default for grub-editenv Colin Watson
@ 2009-09-03 14:16 ` Robert Millan
  2009-09-03 14:28   ` Colin Watson
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Millan @ 2009-09-03 14:16 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Sep 01, 2009 at 05:19:51PM +0100, Colin Watson wrote:
> (Per a discussion with Robert on IRC, this can be post-1.97 if you
> like.)
> 
> Would it make sense for grub-editenv to have a default for the filename?
> I dislike hardcoding something in package maintainer scripts that needs
> to match a #define. The interface would be a little awkward since it's
> grub-editenv FILENAME COMMAND, but we could just say that if you provide
> only one argument then we use the default filename.

OK after 1.97 is out.  Btw, please include a ChangeLog entry next time.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Filename default for grub-editenv
  2009-09-03 14:16 ` Robert Millan
@ 2009-09-03 14:28   ` Colin Watson
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Watson @ 2009-09-03 14:28 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Sep 03, 2009 at 04:16:27PM +0200, Robert Millan wrote:
> On Tue, Sep 01, 2009 at 05:19:51PM +0100, Colin Watson wrote:
> > (Per a discussion with Robert on IRC, this can be post-1.97 if you
> > like.)
> > 
> > Would it make sense for grub-editenv to have a default for the filename?
> > I dislike hardcoding something in package maintainer scripts that needs
> > to match a #define. The interface would be a little awkward since it's
> > grub-editenv FILENAME COMMAND, but we could just say that if you provide
> > only one argument then we use the default filename.
> 
> OK after 1.97 is out.  Btw, please include a ChangeLog entry next time.

I didn't? Bah, I could have sworn I had ...

2009-09-01  Colin Watson  <cjwatson@ubuntu.com>

	* util/grub-editenv.c (main): If only a command is given, use
	DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG as a default file name.
	(usage): FILENAME is now optional and has a default.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-03 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01 16:19 [PATCH] Filename default for grub-editenv Colin Watson
2009-09-03 14:16 ` Robert Millan
2009-09-03 14:28   ` Colin Watson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.