[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:

http://autotest.kernel.org/

The project aims to cover more distros than just
red hat based ones, so this small patch fixes the
tool under Ubuntu. They have chosen to name grub2
grub, in all directory references. Also, they don't
make symlinks of grub config files on /etc. So,
adapt the code to take into consideration this
behavior.

Changes from v1:
  * Removed nested set of {}
  * Made the return in case /etc/grub.d is found
    indented
  * Moved the dbgPrint("not found\n") statement
    before the last return. Also, put a new
    dbgPrint("found\n") if we've found a suitable
    grub2 config file ubuntu/debian style.

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

diff --git a/grubby.c b/grubby.c
index 70a3cda..3061226 100644
--- a/grubby.c
+++ b/grubby.c
@@ -198,9 +198,15 @@ const char *grub2FindConfig(struct configFileInfo *cfi) {
 		dbgPrintf("found\n");
 		return configFiles[i];
 	    }
-	    dbgPrintf("not found\n");
 	}
     }
+    /* Ubuntu renames grub2 to grub */
+	if (configFiles[i] == NULL) {
+		if (!access("/etc/grub.d/", R_OK))
+			dbgPrintf("found\n");
+			return "/boot/grub/grub.cfg";
+	}
+    dbgPrintf("not found\n");
     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