From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsjXq-0002EX-BR for qemu-devel@nongnu.org; Thu, 05 Jun 2014 22:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsjXl-0000jq-Jz for qemu-devel@nongnu.org; Thu, 05 Jun 2014 22:06:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsjXl-0000jm-Ax for qemu-devel@nongnu.org; Thu, 05 Jun 2014 22:06:09 -0400 Message-ID: <5391220E.1060306@redhat.com> Date: Thu, 05 Jun 2014 20:06:06 -0600 From: Eric Blake MIME-Version: 1.0 References: <1402019242-15521-1-git-send-email-vapier@gentoo.org> In-Reply-To: <1402019242-15521-1-git-send-email-vapier@gentoo.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sk8RDJKi0dCCJPVUvb2IV3ug48rxRFLA4" Subject: Re: [Qemu-devel] [PATCH] scripts/qemu-binfmt-conf.sh: rewrite to make user friendly & easier to maintain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mike Frysinger , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sk8RDJKi0dCCJPVUvb2IV3ug48rxRFLA4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/05/2014 07:47 PM, Mike Frysinger wrote: > The current script isn't terribly friendly -- you basically get one cha= nce > to run it per boot w/out manually recovering the system state. >=20 > It also doesn't lend itself to being made into an init script w/out a l= ot > of manual editing. >=20 > Rewrite the sucker with proper functions so that people can easily run = it > and integrate into their system, and make it easier for CPU maintainers= > to add new targets. >=20 > There's also a few fixes smattered about, but considering the whole fil= e > has been written from scratch, not sure they need splitting out. >=20 > Signed-off-by: Mike Frysinger > --- > scripts/qemu-binfmt-conf.sh | 306 ++++++++++++++++++++++++++++++++++--= -------- > 1 file changed, 240 insertions(+), 66 deletions(-) > mode change 100644 =3D> 100755 scripts/qemu-binfmt-conf.sh > +++ b/scripts/qemu-binfmt-conf.sh > @@ -1,72 +1,246 @@ > #!/bin/sh No copyright or license notice? > + > +usage() { > + local ret=3D"${1:-0}" 'local' is a bashism, not compatible with /bin/sh of dash on Debian based systems. > + > +# Usage: has > +# See if can be found in . > +has() { > + local needle=3D"$1" and again (I'll quit pointing it out) > +# Make sure the binfmt_misc filesystem is ready for us to use. > +BINFMT_MISC=3D"/proc/sys/fs/binfmt_misc" > +binfmt_init() { > + if ${dryrun}; then > + return 0 > + fi > + if [ ! -d ${BINFMT_MISC} ]; then Underquoted. Just because $BINFMT_MISC currently happens to not need quoting based on the definition 5 lines above shouldn't give you the excuse to get lazy. > + modprobe binfmt_misc > + fi > + if [ ! -f ${BINFMT_MISC}/register ]; then Underquoted. > + mount binfmt_misc -t binfmt_misc ${BINFMT_MISC} Underquoted. > +# Register the specified magic. > +register() { > + local fmt=3D"$1" > + local arch=3D"$2" > + local path=3D"$(find_qemu "${arch}")" > + local magic=3D":${arch}:${fmt}:${path}:" > + > + unregister "$@" > + > + if [ -z "${path}" ]; then > + echo "${arch}: Could not locate a qemu binary" > + else > + decho "${arch}: would register using ${path}" > + decho "${arch}: echo '${magic}' > ${BINFMT_MISC}/register" > + if ! ${dryrun}; then > + if ! echo "${magic}" > ${BINFMT_MISC}/register; then Underquoted. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sk8RDJKi0dCCJPVUvb2IV3ug48rxRFLA4 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTkSIOAAoJEKeha0olJ0Nqj3EH/2qeeEa5SBI20YQqOd3Ui2M2 EIQGdQi2LM6xn3k+bUnJb0u1Pf5wC9Vzun1PndEWPTgIaio1VWRjRqSFpGPjJ3jD WnejFj9TZbiJtcsZOtqjfLYDcu5M4ozqhZCZmWqS8dFwjo9sy4i3X0HfE+EBso0H uKLG0PaCOVc/0fwCNG3yo6IJfmRhqppyYlAOX3zyQo5FVdTN8WNuFkhtbUF5HzFj WG4z6h1vwgDTnOqj8u+6jYqgdUmVX2v+JqTCXGj1gWKCw/BBrvWzoqBchLBjqFXp QhQOwX0komvCW/Cee9eNUWiYkHIjRrfYqGW9MNUy7sdT+k9XJ5Ko77odEoUToQs= =Vpui -----END PGP SIGNATURE----- --sk8RDJKi0dCCJPVUvb2IV3ug48rxRFLA4--