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 > Ubuntu > Ubuntu Desktop

 
 
LinkBack Thread Tools
 
Old 10-11-2011, 06:50 PM
Lucas Meneghel Rodrigues
 
Default Make grubby to recognize Ubuntu's spin of Grub2

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@redhat.com>
---
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
");
}
}
+ /* 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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-11-2011, 07:48 PM
Peter Jones
 
Default Make grubby to recognize Ubuntu's spin of Grub2

On 10/11/2011 02:50 PM, Lucas Meneghel Rodrigues wrote:
> 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@redhat.com>
> ---
> 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
");
> }
> }
> + /* Ubuntu renames grub2 to grub */
> + if (configFiles[i] == NULL) {
> + if (!access("/etc/grub.d/", R_OK)) {
> + return "/boot/grub/grub.cfg";
> + }
> + }
> return configFiles[i];
> }
>

A couple of minor issues:

a) the style here is quite right - there's no need for the nested set of {},
and the return should be indented.
b) the dbgPrint("not found
") should be moved to a check just before the
last return

> @@ -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;

Sure.

--
Peter

Computers have already beaten communists at chess. The next thing you
know, they'll be beating humans.
-- Dale

01234567890123456789012345678901234567890123456789 012345678901234567890123456789

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-11-2011, 08:20 PM
Lucas Meneghel Rodrigues
 
Default Make grubby to recognize Ubuntu's spin of Grub2

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
") statement
before the last return. Also, put a new
dbgPrint("found
") if we've found a suitable
grub2 config file ubuntu/debian style.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
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
");
return configFiles[i];
}
- dbgPrintf("not found
");
}
}
+ /* Ubuntu renames grub2 to grub */
+ if (configFiles[i] == NULL) {
+ if (!access("/etc/grub.d/", R_OK))
+ dbgPrintf("found
");
+ return "/boot/grub/grub.cfg";
+ }
+ dbgPrintf("not found
");
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:45 PM.

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