dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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