FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian dpkg

 
 
LinkBack Thread Tools
 
Old 01-30-2012, 07:41 PM
Cleber Rosa
 
Default RFC: ppc64/yaboot: add support for probing the currently installed bootloader

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
grubby.c | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/grubby.c b/grubby.c
index 39d7846..3abdc94 100644
--- a/grubby.c
+++ b/grubby.c
@@ -3092,6 +3092,22 @@ int checkForExtLinux(struct grubConfig * config) {
return checkDeviceBootloader(boot, bootSect);
}

+int checkForYaboot(struct grubConfig * config) {
+ /*
+ * This is a simplistic check, trully a placeholder. To properly check if
+ * yaboot is *installed* we'd need to:
+ * 1) get the system boot device (LT_BOOT)
+ * 2) considering it's a raw filesystem, check if the yaboot binary matches
+ * the content on the boot device
+ * 3) if not, copy the binary to a temporary file and run "addnote" on it
+ * 4) check again if binary and boot device contents match
+ */
+ if (!access("/etc/yaboot.conf", R_OK))
+ return 2;
+
+ return 1;
+}
+
static char * getRootSpecifier(char * str) {
char * idx, * rootspec = NULL;

@@ -3579,9 +3595,9 @@ int main(int argc, const char ** argv) {
{ "boot-filesystem", 0, POPT_ARG_STRING, &bootPrefix, 0,
_("filestystem which contains /boot directory (for testing only)"),
_("bootfs") },
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__) || defined (__powerpc64__)
{ "bootloader-probe", 0, POPT_ARG_NONE, &bootloaderProbe, 0,
- _("check if lilo is installed on lilo.conf boot sector") },
+ _("check which bootloader is installed on boot sector") },
#endif
{ "config-file", 'c', POPT_ARG_STRING, &grubConfig, 0,
_("path to grub config file to update ("-" for stdin)"),
@@ -3821,8 +3837,8 @@ int main(int argc, const char ** argv) {
}

if (bootloaderProbe) {
- int lrc = 0, grc = 0, gr2c = 0, erc = 0;
- struct grubConfig * lconfig, * gconfig;
+ int lrc = 0, grc = 0, gr2c = 0, erc = 0, yrc = 0;
+ struct grubConfig * lconfig, * gconfig, * yconfig;

const char *grub2config = grub2FindConfig(&grub2ConfigType);
if (grub2config) {
@@ -3858,12 +3874,23 @@ int main(int argc, const char ** argv) {
erc = checkForExtLinux(lconfig);
}

- if (lrc == 1 || grc == 1 || gr2c == 1) return 1;
+
+ if (!access(yabootConfigType.defaultConfig, F_OK)) {
+ yconfig = readConfig(yabootConfigType.defaultConfig,
+ &yabootConfigType);
+ if (!yconfig)
+ yrc = 1;
+ else
+ yrc = checkForYaboot(lconfig);
+ }
+
+ if (lrc == 1 || grc == 1 || gr2c == 1 || yrc == 1) return 1;

if (lrc == 2) printf("lilo
");
if (gr2c == 2) printf("grub2
");
if (grc == 2) printf("grub
");
if (erc == 2) printf("extlinux
");
+ if (yrc == 2) printf("yaboot
");

return 0;
}
--
1.7.6.5

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

Thread Tools




All times are GMT. The time now is 08:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org