grub-devel
[Top][All Lists]
Advanced

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

Re: [RFC] grub-install C rewrite


From: Andrey Borzenkov
Subject: Re: [RFC] grub-install C rewrite
Date: Sun, 6 Oct 2013 19:56:10 +0400

В Sun, 06 Oct 2013 16:54:08 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <address@hidden> пишет:

> On 26.09.2013 15:08, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> > Hello, all. Recently I made some order in hostdisk.c and getroot.c
> > involving splitting in OS-specific parts.
> > In the same time I added WinAPI version of getroot/hostdisk allowing
> > grub-probe to work on windows natively
> > Also on-going is AROS-specific parts.
> > Windows and AROS are not friendly with bash.
> > The attempt to make both multiple files of same type work and handling
> > whitespaces/newlines/... in filenames would result in very ugly code
> > with loads of evals.
> > Current code may have subtle assumptions on behaviour of common tools
> > like sed and on locale (E.g. "[a-z]" doesn't cover u if locale is Estonian).
> > So to check viability I rewrote grub-install in C. This is mostly proof
> > of concept with loads of FIXMEs but I could boot i386-pc install made
> > with it. In many aspects (static variables, some tests, general
> > structure) it's reminiscent of sh version of grub-install it's based on.
> > Some functionality is likely to stay OS-specific, e.g. executing
> > compressors or determining firmware.
> Attached is the second iteration of this patch.

> @@ -308,6 +310,7 @@
>    installdir = sbin;
>    mansection = 8;
>    common = util/grub-setup.c;
> +  common = util/setup_bios.c;
+  extra_dist = util/setup.c;

> @@ -324,6 +327,7 @@
>    installdir = sbin;
>    mansection = 8;
>    common = util/grub-setup.c;
> +  common = util/setup_sparc.c;
+  extra_dist = util/setup.c;

> +program = {
>    mansection = 8;
>    installdir = sbin;
>    name = grub-install;
>  
> -  common = util/grub-install_header;
> -  common = util/grub-install.in;
> +  common = util/mkimage.c;
> +  common = util/grub-install.c;
> +  common = util/grub-install-common.c;
> +  common = util/setup_bios.c;
> +  common = util/setup_sparc.c;
+  extra_dist = util/setup.c;


>                                                 Now the biggest problem
> is in reading /etc/default/grub and getting GRUB_DISTRIBUTOR and
> GRUB_ENABLE_CRYPTODISK. Trouble is that now this file is simply included
> in bash script and e.g. Debian uses it to determine GRUB_DISTRIBUTOR
> based on lsb_release output. Does anyone have an elegant solution for this?
> 

If declaring this as unsupported is not an option, the only solution is
wrapper, something like

sh -c '/etc/default/grub; printf
GRUB_DISTRIBUTOR=%s\\nGRUB_ENABLE_CRYPTODISK=%s\\n "$GRUB_DISTRIBUTOR" 
"$GRUB_ENABLE_CRYPTODISK"'

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]