[Pkg-libvirt-commits] [libguestfs] 232/384: customize: add copy-in operation (RHBZ#1135585).

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:57:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 573fe962b986e90584afa71aa3e9d9d4448190da
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Mon Feb 2 15:44:43 2015 +0100

    customize: add copy-in operation (RHBZ#1135585).
    
    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     | 11 +++++++++++
 3 files changed, 16 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..7fe0f4d 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -85,6 +85,17 @@ 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.";
+  };
+
   { op_name = "delete";
     op_type = String "PATH";
     op_discrim = "`Delete";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list