nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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