Blame SOURCES/0260-set-rootpath.patch

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