[Libguestfs] [PATCH] customize: fix running commands on the same architecture

Richard W.M. Jones rjones at redhat.com
Mon Aug 31 15:01:43 UTC 2015


On Mon, Aug 31, 2015 at 11:20:32AM +0200, Pino Toscano wrote:
> Wrap the command around an heredoc only if setarch needs to be used;
> otherwise the heredoc will not be run at all.
> 
> Fix commit d875346ad441d4762455ea1b41d57ad6174d9b63.

ACK.

Rich.

>  customize/customize_run.ml | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/customize/customize_run.ml b/customize/customize_run.ml
> index 2283272..9d97522 100644
> --- a/customize/customize_run.ml
> +++ b/customize/customize_run.ml
> @@ -70,18 +70,20 @@ let run (g : Guestfs.guestfs) root (ops : ops) =
>        ) [ "http_proxy"; "https_proxy"; "ftp_proxy"; "no_proxy" ] in
>      let env_vars = String.concat "\n" env_vars ^ "\n" in
>  
> -    let setarch =
> +    let cmd =
>        match Config.host_cpu, guest_arch with
> -      | "x86_64", ("i386"|"i486"|"i586"|"i686") -> "setarch i686"
> -      | _ -> "" in
> +      | "x86_64", ("i386"|"i486"|"i586"|"i686") ->
> +        sprintf "setarch i686 <<\"__EOCMD\"
> +%s
> +__EOCMD
> +" cmd
> +      | _ -> cmd in
>  
>      let cmd = sprintf "\
>  exec >>%s 2>&1
>  %s
> -%s <<\"__EOCMD\"
>  %s
> -__EOCMD
> -" (quote logfile) env_vars setarch cmd in
> +" (quote logfile) env_vars cmd in
>  
>      if verbose () then printf "running command:\n%s\n%!" cmd;
>      try ignore (g#sh cmd)
> -- 
> 2.1.0
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list