nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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