From 7bdb3e0df93ef9cdee11b40a85056e609de45414 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Mon, 31 Aug 2015 11:17:45 +0200 Subject: [PATCH] customize: fix running commands on the same architecture 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. --- 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 2283272aa..9d97522e6 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)