From 82f07dbeb68320d31497a49f33585ca0a839ea7a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 21 Mar 2015 22:12:25 +0000 Subject: [PATCH] templates: Use shell variables to pass parameters to 'build'. Also allow the hostname of the guest to be set. --- mclu_boot.ml | 17 +++++++++++++---- templates/rawhide.template | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mclu_boot.ml b/mclu_boot.ml index b4fb92f..43ab049 100644 --- a/mclu_boot.ml +++ b/mclu_boot.ml @@ -239,10 +239,19 @@ Try: `mclu on %s'\n" hostname hostname; ); let cmd = (* XXX Don't hard-code network_bridge here. *) - sprintf "ssh root@%s LIBGUESTFS_BACKEND_SETTINGS=network_bridge=br0 %s build %s %s %s" - (quote hostname) remote_filename - (quote template_info.Template.base_image) (quote remote_image) - format in + sprintf "ssh root@%s \ +LIBGUESTFS_BACKEND_SETTINGS=network_bridge=br0 \ +base_image=%s \ +format=%s \ +name=%s \ +output=%s \ +%s build" + (quote hostname) + (quote template_info.Template.base_image) (* base_image *) + format (* format *) + name (* name *) + (quote remote_image) (* output *) + remote_filename in if verbose then printf "%s\n%!" cmd; if Sys.command cmd <> 0 then ( eprintf "mclu: remote build failed\n"; diff --git a/templates/rawhide.template b/templates/rawhide.template index cbf8532..8406f0f 100755 --- a/templates/rawhide.template +++ b/templates/rawhide.template @@ -9,7 +9,8 @@ case "$1" in # Build image. build) - virt-builder "$2" --output "$3" --format "$4" \ + virt-builder "$base_image" --output "$output" --format "$format" \ + --hostname "$name" \ --install fedora-repos-rawhide \ --update \ --root-password password:123456 \ -- 1.8.3.1