dcavalca / rpms / grub2

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