grub2/0221-set-rootpath.patch

50 lines
1.3 KiB
Diff

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