[Libguestfs] [PATCH v2 2/2] customize: add globbing for --delete
Richard W.M. Jones
rjones at redhat.com
Thu Feb 4 11:35:32 UTC 2016
On Thu, Feb 04, 2016 at 11:26:52AM +0100, Pino Toscano wrote:
> 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.
> ---
> 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 84f634b..82c4edd 100644
> --- a/customize/customize_run.ml
> +++ b/customize/customize_run.ml
> @@ -191,7 +191,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 19aec81..d272ffb 100644
> --- a/generator/customize.ml
> +++ b/generator/customize.ml
> @@ -115,6 +115,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>.";
> };
ACK series.
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list