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

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