dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0131-use-fw_path-prefix-when-fallback-searching-for-grub-.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
f725e3
Date: Wed, 19 Feb 2014 15:58:43 -0500
f725e3
Subject: [PATCH] use fw_path prefix when fallback searching for grub config
f725e3
f725e3
When PXE booting via UEFI firmware, grub was searching for grub.cfg
f725e3
in the fw_path directory where the grub application was found. If
f725e3
that didn't exist, a fallback search would look for config file names
f725e3
based on MAC and IP address. However, the search would look in the
f725e3
prefix directory which may not be the same fw_path. This patch
f725e3
changes that behavior to use the fw_path directory for the fallback
f725e3
search. Only if fw_path is NULL will the prefix directory be searched.
f725e3
f725e3
Signed-off-by: Mark Salter <msalter@redhat.com>
f725e3
---
f725e3
 grub-core/normal/main.c | 5 +++--
f725e3
 1 file changed, 3 insertions(+), 2 deletions(-)
f725e3
f725e3
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
f725e3
index f66c03c4c6e..5e2ac150e12 100644
f725e3
--- a/grub-core/normal/main.c
f725e3
+++ b/grub-core/normal/main.c
f725e3
@@ -343,7 +343,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
f725e3
       char *config;
f725e3
       const char *prefix, *fw_path;
f725e3
 
f725e3
-      fw_path = grub_env_get ("fw_path");
f725e3
+      prefix = fw_path = grub_env_get ("fw_path");
f725e3
       if (fw_path)
f725e3
 	{
f725e3
 	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
f725e3
@@ -366,7 +366,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
f725e3
 	    }
f725e3
 	}
f725e3
 
f725e3
-      prefix = grub_env_get ("prefix");
f725e3
+      if (! prefix)
f725e3
+	      prefix = grub_env_get ("prefix");
f725e3
       if (prefix)
f725e3
         {
f725e3
           grub_size_t config_len;