From faa050d685a7c7005d683b716bcb657bdf958440 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Thu, 4 Feb 2016 10:49:31 +0100
Subject: [PATCH] customize: add globbing for --delete
Support globbing in paths passed to --delete, telling glob to not
return directories with leading slash.
This re-adds back globbing for --delete in virt-sysprep, which was
available before the integration with common code from virt-customize.
(cherry picked from commit 13c3698358a4de82179dba3c8855f56746525aa7)
---
customize/customize_run.ml | 2 +-
generator/customize.ml | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 2caaa98..8c38d62 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -205,7 +205,7 @@ exec >>%s 2>&1
| `Delete path ->
message (f_"Deleting: %s") path;
- g#rm_rf path
+ Array.iter g#rm_rf (g#glob_expand ~directoryslash:false path)
| `Edit (path, expr) ->
message (f_"Editing: %s") path;
diff --git a/generator/customize.ml b/generator/customize.ml
index 63e4246..403bb89 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -117,6 +117,12 @@ Wildcards cannot be used.";
Delete a file from the guest. Or delete a directory (and all its
contents, recursively).
+You can use shell glob characters in the specified path. Be careful
+to escape glob characters from the host shell, if that is required.
+For example:
+
+ virt-customize --delete '/var/log/*.log'.
+
See also: I<--upload>, I<--scrub>.";
};
--
1.8.3.1