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

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