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

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

 



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

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\n") 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

01234567890123456789012345678901234567890123456789012345678901234567890123456789

_______________________________________________
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