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