nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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