From 23f8cab1e85fd77b053cc880d31687261c81e357 Mon Sep 17 00:00:00 2001 From: Wanlong Gao Date: Fri, 27 Apr 2012 14:18:53 +0800 Subject: sysprep: Remove the data of dovecot Remove the data of dovecot. Signed-off-by: Wanlong Gao --- sysprep/Makefile.am | 2 ++ sysprep/sysprep_operation_dovecot_data.ml | 43 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 sysprep/sysprep_operation_dovecot_data.ml (limited to 'sysprep') diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index e2b4806c..2424071e 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -37,6 +37,7 @@ SOURCES = \ sysprep_operation_cron_spool.ml \ sysprep_operation_dhcp_client_state.ml \ sysprep_operation_dhcp_server_state.ml \ + sysprep_operation_dovecot_data.ml \ sysprep_operation_flag_reconfiguration.ml \ sysprep_operation_hostname.ml \ sysprep_operation_logfiles.ml \ @@ -67,6 +68,7 @@ OBJECTS = \ sysprep_operation_cron_spool.cmx \ sysprep_operation_dhcp_client_state.cmx \ sysprep_operation_dhcp_server_state.cmx \ + sysprep_operation_dovecot_data.cmx \ sysprep_operation_flag_reconfiguration.cmx \ sysprep_operation_hostname.cmx \ sysprep_operation_logfiles.cmx \ diff --git a/sysprep/sysprep_operation_dovecot_data.ml b/sysprep/sysprep_operation_dovecot_data.ml new file mode 100644 index 00000000..65825ba3 --- /dev/null +++ b/sysprep/sysprep_operation_dovecot_data.ml @@ -0,0 +1,43 @@ +(* virt-sysprep + * Copyright (C) 2012 FUJITSU LIMITED + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +open Sysprep_operation + +module G = Guestfs + +let dovecot_data_perform g root = + let typ = g#inspect_get_type root in + if typ <> "windows" then ( + let files = g#glob_expand "/var/lib/dovecot/*" in + Array.iter ( + fun file -> try g#rm file with G.Error _ -> () + ) files; + [] + ) + else [] + +let dovecot_data_op = { + name = "dovecot-data"; + enabled_by_default = true; + heading = "Remove Dovecot (mail server) data"; + pod_description = None; + extra_args = []; + perform = dovecot_data_perform; +} + +let () = register_operation dovecot_data_op -- cgit