dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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