Blame SOURCES/0260-set-rootpath.patch

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