Blame SOURCES/0257-set-rootpath.patch

6b3c76
From 620997ba9e7b4d0f0eaaccc8fbff08b746f78bef Mon Sep 17 00:00:00 2001
a85e8e
From: Peter Jones <pjones@redhat.com>
a85e8e
Date: Wed, 24 May 2017 15:02:40 -0400
6b3c76
Subject: [PATCH 257/261] set rootpath
a85e8e
a85e8e
Signed-off-by: Peter Jones <pjones@redhat.com>
a85e8e
---
a85e8e
 grub-core/net/bootp.c | 20 ++++++++++++++++++++
a85e8e
 1 file changed, 20 insertions(+)
a85e8e
a85e8e
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
6b3c76
index fa7eefe51..017531d87 100644
a85e8e
--- a/grub-core/net/bootp.c
a85e8e
+++ b/grub-core/net/bootp.c
a85e8e
@@ -398,11 +398,31 @@ grub_net_configure_by_dhcp_ack (const char *name,
a85e8e
 	      if (*path)
a85e8e
 		{
a85e8e
 		  char *slash;
a85e8e
+		  int root_path_len;
a85e8e
 		  slash = grub_strrchr (*path, '/');
a85e8e
 		  if (slash)
a85e8e
 		    *slash = 0;
a85e8e
 		  else
a85e8e
 		    **path = 0;
a85e8e
+		  root_path_len = grub_strlen (*path);
a85e8e
+		  if (root_path_len >= 9 &&
a85e8e
+		      !grub_strcasecmp (&(*path)[root_path_len - 9], "/efi/boot"))
a85e8e
+		    {
a85e8e
+		      char *root_path;
a85e8e
+		      grub_print_error ();
a85e8e
+		      if (root_path_len - 9 == 0)
a85e8e
+			{
a85e8e
+			  root_path_len = 1;
a85e8e
+			  root_path = grub_xasprintf ("/");
a85e8e
+			}
a85e8e
+		      else
a85e8e
+			{
a85e8e
+			  root_path_len -= 9;
a85e8e
+			  root_path = grub_strndup (*path, root_path_len);
a85e8e
+			}
a85e8e
+		      grub_env_set_net_property (name, "rootpath",
a85e8e
+						 root_path, root_path_len);
a85e8e
+		    }
a85e8e
 		}
a85e8e
 	    }
a85e8e
 	  grub_net_add_ipv4_local (inter, mask);
6b3c76
-- 
6b3c76
2.13.5
6b3c76