nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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