qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Mike Frysinger <vapier@gentoo.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] scripts/qemu-binfmt-conf.sh: rewrite to make user friendly & easier to maintain
Date: Thu, 05 Jun 2014 20:06:06 -0600	[thread overview]
Message-ID: <5391220E.1060306@redhat.com> (raw)
In-Reply-To: <1402019242-15521-1-git-send-email-vapier@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 2538 bytes --]

On 06/05/2014 07:47 PM, Mike Frysinger wrote:
> The current script isn't terribly friendly -- you basically get one chance
> to run it per boot w/out manually recovering the system state.
> 
> It also doesn't lend itself to being made into an init script w/out a lot
> of manual editing.
> 
> 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.
> 
> There's also a few fixes smattered about, but considering the whole file
> has been written from scratch, not sure they need splitting out.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  scripts/qemu-binfmt-conf.sh | 306 ++++++++++++++++++++++++++++++++++----------
>  1 file changed, 240 insertions(+), 66 deletions(-)
>  mode change 100644 => 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="${1:-0}"

'local' is a bashism, not compatible with /bin/sh of dash on Debian
based systems.


> +
> +# Usage: has <needle> <list of haystack items>
> +# See if <needle> can be found in <haystack>.
> +has() {
> +  local needle="$1"

and again (I'll quit pointing it out)


> +# Make sure the binfmt_misc filesystem is ready for us to use.
> +BINFMT_MISC="/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="$1"
> +  local arch="$2"
> +  local path="$(find_qemu "${arch}")"
> +  local magic=":${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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-06-06  2:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  1:47 [Qemu-devel] [PATCH] scripts/qemu-binfmt-conf.sh: rewrite to make user friendly & easier to maintain Mike Frysinger
2014-06-06  2:06 ` Eric Blake [this message]
2014-06-06  9:56 ` Peter Maydell
2014-06-06 12:29 ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5391220E.1060306@redhat.com \
    --to=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).