nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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