Add the copy-in operation to virt-customize/builder/sysprep, so it is possible to easily copy directories at once in the guest. --- builder/cmdline.ml | 2 +- customize/customize_run.ml | 4 ++++ generator/customize.ml | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/builder/cmdline.ml b/builder/cmdline.ml index 1c6ab98..9dad141 100644 --- a/builder/cmdline.ml +++ b/builder/cmdline.ml @@ -309,7 +309,7 @@ read the man page virt-builder(1). | `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _ | `Password _ | `RootPassword _ | `Scrub _ | `SSHInject _ | `Timezone _ | `Upload _ | `Write _ | `Chmod _ - | `CommandsFromFile _ -> false + | `CommandsFromFile _ | `CopyIn _ -> false ) ops.ops in if requires_execute_on_guest then error (f_"sorry, cannot run commands on a guest with a different architecture"); diff --git a/customize/customize_run.ml b/customize/customize_run.ml index fed905b..3c82cb4 100644 --- a/customize/customize_run.ml +++ b/customize/customize_run.ml @@ -175,6 +175,10 @@ exec >>%s 2>&1 * read when their arguments are met. *) () + | `CopyIn (localpath, remotedir) -> + msg (f_"Copying: %s to %s") localpath remotedir; + g#copy_in localpath remotedir + | `Delete path -> msg (f_"Deleting: %s") path; g#rm_rf path diff --git a/generator/customize.ml b/generator/customize.ml index c041f82..1c9092b 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -85,6 +85,19 @@ as if they were specified as I<--delete /some/file> on the command line."; }; + { op_name = "copy-in"; + op_type = StringPair "LOCALPATH:REMOTEDIR"; + op_discrim = "`CopyIn"; + op_shortdesc = "Copy local files or directories into image"; + op_pod_longdesc = "\ +Copy local files or directories recursively into the disk image, +placing them in the directory C<REMOTEDIR> (which must exist). + +Wildcards cannot be used. + +See also: I<--copy-out>."; + }; + { op_name = "delete"; op_type = String "PATH"; op_discrim = "`Delete"; -- 1.9.3