[Pkg-libvirt-commits] [libguestfs] 325/384: customize: add --truncate option (RHBZ#119673)

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:58:44 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 a084758e83eddb0c5b57ce904856218240011419
Author: Maros Zatko <mzatko at redhat.com>
Date:   Thu Mar 5 01:03:54 2015 +0100

    customize: add --truncate option (RHBZ#119673)
---
 builder/cmdline.ml         | 2 +-
 customize/customize_run.ml | 4 ++++
 generator/customize.ml     | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index b8227cc..b7e7e07 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
@@ -313,7 +313,7 @@ read the man page virt-builder(1).
           | `Delete _ | `Edit _ | `FirstbootCommand _ | `FirstbootPackages _
           | `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _
           | `Password _ | `RootPassword _ | `Scrub _ | `SSHInject _
-          | `Timezone _ | `Upload _ | `Write _ | `Chmod _
+          | `Truncate _ | `Timezone _ | `Upload _ | `Write _ | `Chmod _
           | `CommandsFromFile _ | `CopyIn _ -> false
         ) ops.ops in
         if requires_execute_on_guest then
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 980df7e..921bc7e 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -247,6 +247,10 @@ exec >>%s 2>&1
       | _ ->
         warning (f_"SSH key could be injected for this type of guest"))
 
+    | `Truncate path ->
+      msg (f_"Truncating: %s") path;
+      g#truncate path
+
     | `Timezone tz ->
       msg (f_"Setting the timezone: %s") tz;
       if not (Timezone.set_timezone g root tz) then
diff --git a/generator/customize.ml b/generator/customize.ml
index 7fe0f4d..f7ec3f2 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -317,6 +317,15 @@ You can have multiple I<--ssh-inject> options, for different users
 and also for more keys for each user."
   };
 
+  { op_name = "truncate";
+    op_type = String "FILE";
+    op_discrim = "`Truncate";
+    op_shortdesc = "Truncate a file to zero size";
+    op_pod_longdesc = "\
+This command truncates \"path\" to a zero-length file. The file must exist
+already.";
+  };
+
   { op_name = "timezone";
     op_type = String "TIMEZONE";
     op_discrim = "`Timezone";

-- 
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