grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] normalize default prefix in grub-mkimage
Date: Tue, 21 Jan 2014 20:48:41 +0400	[thread overview]
Message-ID: <20140121204841.0c0ae8af@opensuse.site> (raw)
In-Reply-To: <52DE1F7C.3080809@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2970 bytes --]

В Tue, 21 Jan 2014 08:19:24 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:

> On 27.12.2013 18:41, Andrey Borzenkov wrote:
> > This fixes bogus "C:\boot\grub" at runtime for Windows build as well as
> > the case when /boot is on separate mount point for other systems.
> > 
> grub-mkimage shouldn't perform any FS-based resolving, that's job of the
> caller. This default should either be hardwired to
> "/"GRUB_BOOT_DIR_NAME"/"GRUB_DIR_NAME
> or perhaps even to "/boot/grub" or default should be killed altogether.

I prefer the latter. Any default will most likely be wrong, so it is
better to be explicit about it.

From: Andrey Borzenkov <arvidjaar@gmail.com>
Subject: [PATCH] do not set default prefix in grub-mkimage

Default prefix is likely wrong on Unix and completely wrong on Windows.
Let caller set it explicitly to avoid any ambiguity.

---
 util/grub-mkimage.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
index a2bd4c1..1e0bcf1 100644
--- a/util/grub-mkimage.c
+++ b/util/grub-mkimage.c
@@ -64,7 +64,7 @@ static struct argp_option options[] = {
   {"directory",  'd', N_("DIR"), 0,
    /* TRANSLATORS: platform here isn't identifier. It can be translated.  */
    N_("use images and modules under DIR [default=%s/<platform>]"), 0},
-  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0},
+  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory"), 0},
   {"memdisk",  'm', N_("FILE"), 0,
    /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated.
     "embed" is a verb (command description).  "*/
@@ -93,8 +93,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
     {
     case 'd':
       return xasprintf (text, grub_util_get_pkglibdir ());
-    case 'p':
-      return xasprintf (text, DEFAULT_DIRECTORY);
     case 'O':
       {
 	char *formats = grub_install_get_image_targets_string (), *ret;
@@ -268,6 +266,15 @@ main (int argc, char *argv[])
       exit(1);
     }
 
+  if (!arguments.prefix)
+    {
+      char *program = xstrdup(program_name);
+      printf ("%s\n", _("Prefix not specified (use the -p option)."));
+      argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program);
+      free (program);
+      exit(1);
+    }
+
   if (arguments.output)
     {
       fp = grub_util_fopen (arguments.output, "wb");
@@ -287,8 +294,7 @@ main (int argc, char *argv[])
       strcpy (ptr, dn);
     }
 
-  grub_install_generate_image (arguments.dir,
-			       arguments.prefix ? : DEFAULT_DIRECTORY, fp,
+  grub_install_generate_image (arguments.dir, arguments.prefix, fp,
 			       arguments.output, arguments.modules,
 			       arguments.memdisk, arguments.pubkeys,
 			       arguments.npubkeys, arguments.config,
-- 
tg: (443b322..) u/mingw/default-prefix (depends on: master)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2014-01-21 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27 17:41 [PATCH] normalize default prefix in grub-mkimage Andrey Borzenkov
2014-01-21  7:19 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-21 16:48   ` Andrey Borzenkov [this message]
2014-01-22 15:07     ` Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140121204841.0c0ae8af@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).