On 3/12/19 2:51 PM, Unai Martinez-Corral wrote:
> Allow to set options '--persistent' and/or '--credential' through
> environment variables. If not defined, defaults are used ('no').
> Anyway, command-line arguments have priority over environment variables.
> 
> Signed-off-by: Unai Martinez-Corral <unai.martinezcor...@ehu.eus>
> Reviewed-by: Laurent Vivier <laur...@vivier.eu>
> ---
>  scripts/qemu-binfmt-conf.sh | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index ca15ff8092..ad9ae731a0 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -186,9 +186,11 @@ Usage: qemu-binfmt-conf.sh [--qemu-path 
> PATH][--debian][--systemd CPU]
>                        (default: $SYSTEMDDIR or $DEBIANDIR)

Remember, this is in an unquoted heredoc, so it looks something like:

(default: /etc/systemd or /usr/share/binfmts)

when actually printed.

>         --credential:  if present, credential and security tokens are
>                        calculated according to the binary to interpret
> +                      ($QEMU_CREDENTIAL=yes)
>         --persistent:  if present, the interpreter is loaded when binfmt is
>                        configured and remains in memory. All future uses
>                        are cloned from the open file.
> +                      ($QEMU_PERSISTENT=yes)
> 

And with your change, when the environment starts empty (and thus the
script's default initialization of QEMU_PERSISTENT kicks in), this will
look like:

(no=yes)

You probably meant to write:

(default: \$QEMU_PERSISTENT=no)

to produce output of:

(default: $QEMU_PERSISTENT=no)

or:

(default: \${QEMU_PERSISTENT:-no})

to produce output of:

(default: ${QEMU_PERSISTENT:-no})

both to clarify that it defaults from the environment, and that its
default is no rather than yes.


> +
> +QEMU_PERSISTENT="${QEMU_PERSISTENT:-no}"
> +QEMU_CREDENTIAL="${QEMU_CREDENTIAL:-no}"
> +
>  QEMU_SUFFIX=""
> 
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to