From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VSqh7-0006xj-2C for mharc-grub-devel@gnu.org; Sun, 06 Oct 2013 11:56:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSqgw-0006pw-QB for grub-devel@gnu.org; Sun, 06 Oct 2013 11:56:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSqgn-0005zi-Ce for grub-devel@gnu.org; Sun, 06 Oct 2013 11:56:22 -0400 Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]:49905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSqgn-0005xV-4q for grub-devel@gnu.org; Sun, 06 Oct 2013 11:56:13 -0400 Received: by mail-lb0-f179.google.com with SMTP id x18so4743701lbi.38 for ; Sun, 06 Oct 2013 08:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=dGoO5V9mlelXubZxZvg1j1g6wVM2Gtnjjw0sUktyXN4=; b=trPNoWKxFwAbT21WfKLQoE+2Y0KMgtAsvt1A9bjAKNek4geu4IBzWGij6WMDbz13VY z7hBDL6jmvX+7g04CyI1gPD5nt0ScIoy/vO8qVyQZfKxduBerqF5rHnGa1kudjT6YJtR HjmnzAJ9lQbX010wzNKg7yYYd0sGa44IlRzHdpjGf72xhdqI2ufl31xZ35zi/ypnGrSH hAehQImteSh5WqW03VpxRY3rVfD/6g7l7vzqtbpm2HDIW/9OYI1O/7qTg/4D7tbNWtOe kvtWameTT107qYZoOnuyesUvkKtARD8CsWCDhS44jsO0Q1aaMdJGNeodp32QisPJNDPw j4pQ== X-Received: by 10.112.156.166 with SMTP id wf6mr21258428lbb.13.1381074971833; Sun, 06 Oct 2013 08:56:11 -0700 (PDT) Received: from opensuse.site (ppp91-76-150-246.pppoe.mtu-net.ru. [91.76.150.246]) by mx.google.com with ESMTPSA id o1sm21053980lah.8.1969.12.31.16.00.00 (version=SSLv3 cipher=RC4-SHA bits=128/128); Sun, 06 Oct 2013 08:56:11 -0700 (PDT) Date: Sun, 6 Oct 2013 19:56:10 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [RFC] grub-install C rewrite Message-ID: <20131006195610.523c90b0@opensuse.site> In-Reply-To: <52517990.1020505@gmail.com> References: <524431E6.60807@gmail.com> <52517990.1020505@gmail.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/GPhJ.pxMRskI/yO4CmWvvnU"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::233 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 15:56:31 -0000 --Sig_/GPhJ.pxMRskI/yO4CmWvvnU Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Sun, 06 Oct 2013 16:54:08 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 26.09.2013 15:08, Vladimir '=CF=86-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 Eston= ian). > > 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 =3D sbin; > mansection =3D 8; > common =3D util/grub-setup.c; > + common =3D util/setup_bios.c; + extra_dist =3D util/setup.c; > @@ -324,6 +327,7 @@ > installdir =3D sbin; > mansection =3D 8; > common =3D util/grub-setup.c; > + common =3D util/setup_sparc.c; + extra_dist =3D util/setup.c; > +program =3D { > mansection =3D 8; > installdir =3D sbin; > name =3D grub-install; > =20 > - common =3D util/grub-install_header; > - common =3D util/grub-install.in; > + common =3D util/mkimage.c; > + common =3D util/grub-install.c; > + common =3D util/grub-install-common.c; > + common =3D util/setup_bios.c; > + common =3D util/setup_sparc.c; + extra_dist =3D 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 thi= s? >=20 If declaring this as unsupported is not an option, the only solution is wrapper, something like sh -c '/etc/default/grub; printf GRUB_DISTRIBUTOR=3D%s\\nGRUB_ENABLE_CRYPTODISK=3D%s\\n "$GRUB_DISTRIBUTOR" = "$GRUB_ENABLE_CRYPTODISK"' --Sig_/GPhJ.pxMRskI/yO4CmWvvnU Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlJRiBoACgkQR6LMutpd94yslACcDqhp3YupKQKaHTKJURtdKUdS ZSsAmwbzLZh+B6QzAOaSiMt3QM4m+NM9 =PB6R -----END PGP SIGNATURE----- --Sig_/GPhJ.pxMRskI/yO4CmWvvnU--