From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VSshw-0003zy-4x for mharc-grub-devel@gnu.org; Sun, 06 Oct 2013 14:05:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSshl-0003tq-9U for grub-devel@gnu.org; Sun, 06 Oct 2013 14:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSshe-0002tY-UA for grub-devel@gnu.org; Sun, 06 Oct 2013 14:05:21 -0400 Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]:56979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSshe-0002sE-HW for grub-devel@gnu.org; Sun, 06 Oct 2013 14:05:14 -0400 Received: by mail-ee0-f45.google.com with SMTP id c50so2786092eek.18 for ; Sun, 06 Oct 2013 11:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=5jD4CVXSWIP75O/wJAv8ojDIYkSSOqS1RFoP45s8vJ8=; b=BVOkNbmtBHv/27tk3EyAnwAz1LwnttvgQBc/8jLnfg6IRU62Wo5JzVpHQsc+yMH9IX Pq3pJk8mAcDcCsHmKsaddU5zkK2MPuJq6wds6ZHv9keoUDTlOzO4ad+4xQnpcPhjwVF2 f0vexXpHh3c+E/rKW6acmVxKBE9RPESewNj606MuvAXUQYMBNKIv3KMuj3I8r4jSAybv 69HmdwArJRt+EbDveBh/X3EmCr/cZj/ke5EtKyQ4xntcWrPdmoy/70l7CQZ11cehE3kP /ovw1JoBr9godVYEuKB1quAjfqLB8Wvj4ED+uWPMiWVV/CPOfvr39NxJQBIWJ45HlD/U Q8iA== X-Received: by 10.15.93.131 with SMTP id w3mr5579459eez.47.1381082713722; Sun, 06 Oct 2013 11:05:13 -0700 (PDT) Received: from [192.168.1.113] (31-249.1-85.cust.bluewin.ch. [85.1.249.31]) by mx.google.com with ESMTPSA id h52sm53651367eez.3.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 06 Oct 2013 11:05:13 -0700 (PDT) Message-ID: <5251A658.3050005@gmail.com> Date: Sun, 06 Oct 2013 20:05:12 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130821 Icedove/17.0.8 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [RFC] grub-install C rewrite References: <524431E6.60807@gmail.com> <52517990.1020505@gmail.com> <20131006195610.523c90b0@opensuse.site> In-Reply-To: <20131006195610.523c90b0@opensuse.site> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="----enig2MAQXOQLOTBKQOWSABEGJ" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22d 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 18:05:27 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2MAQXOQLOTBKQOWSABEGJ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06.10.2013 17:56, Andrey Borzenkov wrote: > =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: >=20 >> 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 handlin= g >>> 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 Est= onian). >>> So to check viability I rewrote grub-install in C. This is mostly pro= of >>> 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. >=20 >> @@ -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; >=20 >> @@ -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; >=20 >> +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; >=20 >=20 >> Now the biggest proble= m >> is in reading /etc/default/grub and getting GRUB_DISTRIBUTOR and >> GRUB_ENABLE_CRYPTODISK. Trouble is that now this file is simply includ= ed >> 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? >> >=20 > If declaring this as unsupported is not an option, the only solution is= > wrapper, something like >=20 > sh -c '/etc/default/grub; printf > GRUB_DISTRIBUTOR=3D%s\\nGRUB_ENABLE_CRYPTODISK=3D%s\\n "$GRUB_DISTRIBUT= OR" "$GRUB_ENABLE_CRYPTODISK"' >=20 Rather sh -c '. /etc/default/grub; printf GRUB_DISTRIBUTOR=3D%s\\nGRUB_ENABLE_CR= YPTODISK=3D%s\\n "$GRUB_DISTRIBUTOR" "$GRUB_ENABLE_CRYPTODISK"' This is probably the best way to do it on Unix-like systems with fallback= for simple parser for other systems. >=20 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 ------enig2MAQXOQLOTBKQOWSABEGJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlJRplgACgkQNak7dOguQglYPgD/Uil+tJkzhj5YhmJoe7RLs+XL B1sHgL1EYvqfsSnOZFUBAK6m8nz/fRDN3SdF1EIW7GLfucJX3Qs7ZTr9hAW0VG6Q =ngWj -----END PGP SIGNATURE----- ------enig2MAQXOQLOTBKQOWSABEGJ--