nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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