nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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