dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
39700a
From: Andrey Borzenkov <arvidjaar@gmail.com>
39700a
Date: Sat, 25 Jan 2014 19:54:51 +0400
28f7f8
Subject: [PATCH] do not set default prefix in grub-mkimage
39700a
39700a
Default prefix is likely wrong on Unix and completely wrong on Windows.
39700a
Let caller set it explicitly to avoid any ambiguity.
39700a
---
39700a
 util/grub-mkimage.c | 16 +++++++++++-----
28f7f8
 ChangeLog           |  4 ++++
39700a
 2 files changed, 15 insertions(+), 5 deletions(-)
39700a
39700a
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
28f7f8
index a2bd4c196e5..1e0bcf1bf4f 100644
39700a
--- a/util/grub-mkimage.c
39700a
+++ b/util/grub-mkimage.c
39700a
@@ -64,7 +64,7 @@ static struct argp_option options[] = {
39700a
   {"directory",  'd', N_("DIR"), 0,
39700a
    /* TRANSLATORS: platform here isn't identifier. It can be translated.  */
39700a
    N_("use images and modules under DIR [default=%s/<platform>]"), 0},
39700a
-  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0},
39700a
+  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory"), 0},
39700a
   {"memdisk",  'm', N_("FILE"), 0,
39700a
    /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated.
39700a
     "embed" is a verb (command description).  "*/
39700a
@@ -93,8 +93,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
39700a
     {
39700a
     case 'd':
39700a
       return xasprintf (text, grub_util_get_pkglibdir ());
39700a
-    case 'p':
39700a
-      return xasprintf (text, DEFAULT_DIRECTORY);
39700a
     case 'O':
39700a
       {
39700a
 	char *formats = grub_install_get_image_targets_string (), *ret;
39700a
@@ -268,6 +266,15 @@ main (int argc, char *argv[])
39700a
       exit(1);
39700a
     }
39700a
 
39700a
+  if (!arguments.prefix)
39700a
+    {
39700a
+      char *program = xstrdup(program_name);
39700a
+      printf ("%s\n", _("Prefix not specified (use the -p option)."));
39700a
+      argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program);
39700a
+      free (program);
39700a
+      exit(1);
39700a
+    }
39700a
+
39700a
   if (arguments.output)
39700a
     {
39700a
       fp = grub_util_fopen (arguments.output, "wb");
39700a
@@ -287,8 +294,7 @@ main (int argc, char *argv[])
39700a
       strcpy (ptr, dn);
39700a
     }
39700a
 
39700a
-  grub_install_generate_image (arguments.dir,
39700a
-			       arguments.prefix ? : DEFAULT_DIRECTORY, fp,
39700a
+  grub_install_generate_image (arguments.dir, arguments.prefix, fp,
39700a
 			       arguments.output, arguments.modules,
39700a
 			       arguments.memdisk, arguments.pubkeys,
39700a
 			       arguments.npubkeys, arguments.config,
28f7f8
diff --git a/ChangeLog b/ChangeLog
28f7f8
index e149d8ef33d..b405b7ee5bd 100644
28f7f8
--- a/ChangeLog
28f7f8
+++ b/ChangeLog
28f7f8
@@ -1,3 +1,7 @@
28f7f8
+2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
28f7f8
+
28f7f8
+	* util/grub-mkimage.c: Make prefix argument mandatory.
28f7f8
+
28f7f8
 2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
28f7f8
 
28f7f8
 	Fix several translatable strings.