[PATCH 1/2] Make grubby to recognize Ubuntu's spin of Grub2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We are looking to use grubby as a bootloader entries
manager for the autotest project. The project aims
to cover more distros than just Red Hat based ones,
so this small patch fixes the grub2 detection under Ubuntu.
They have chosen to name grub2 grub, in all directory
and config file references. While the validity and sanity
of this approach is questionable, our community wants to
support the distro.

This patch uses the presence of /etc/grub.d/ as a way
of confirming we have a grub2 install present.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 grubby.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/grubby.c b/grubby.c
index 70a3cda..7ff33ca 100644
--- a/grubby.c
+++ b/grubby.c
@@ -201,6 +201,12 @@ const char *grub2FindConfig(struct configFileInfo *cfi) {
 	    dbgPrintf("not found\n");
 	}
     }
+    /* Ubuntu renames grub2 to grub */
+	if (configFiles[i] == NULL) {
+		if (!access("/etc/grub.d/", R_OK)) {
+		return "/boot/grub/grub.cfg";
+		}
+	}
     return configFiles[i];
 }
 
@@ -2584,7 +2590,7 @@ int checkForLilo(struct grubConfig * config) {
 }
 
 int checkForGrub2(struct grubConfig * config) {
-    if (!access("/boot/grub2", R_OK))
+    if (!access("/etc/grub.d/", R_OK))
 	return 2;
 
     return 1;
-- 
1.7.6.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux