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

23d2ea
From d98c0be0194a7c0d618b87293f5fc926c09ee611 Mon Sep 17 00:00:00 2001
39700a
From: Andrey Borzenkov <arvidjaar@gmail.com>
39700a
Date: Sat, 25 Jan 2014 19:54:51 +0400
27a4da
Subject: [PATCH 044/260] 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
 ChangeLog           |  4 ++++
39700a
 util/grub-mkimage.c | 16 +++++++++++-----
39700a
 2 files changed, 15 insertions(+), 5 deletions(-)
39700a
39700a
diff --git a/ChangeLog b/ChangeLog
27a4da
index e149d8ef3..b405b7ee5 100644
39700a
--- a/ChangeLog
39700a
+++ b/ChangeLog
39700a
@@ -1,3 +1,7 @@
39700a
+2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
39700a
+
39700a
+	* util/grub-mkimage.c: Make prefix argument mandatory.
39700a
+
39700a
 2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
39700a
 
39700a
 	Fix several translatable strings.
39700a
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
27a4da
index a2bd4c196..1e0bcf1bf 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,
39700a
-- 
27a4da
2.13.0
39700a