summaryrefslogtreecommitdiffstats
path: root/sysprep
diff options
context:
space:
mode:
authorWanlong Gao <gaowanlong@cn.fujitsu.com>2012-04-27 14:18:53 +0800
committerRichard W.M. Jones <rjones@redhat.com>2012-04-27 08:51:03 +0100
commit23f8cab1e85fd77b053cc880d31687261c81e357 (patch)
treea0a6232b02a3af84b0c4f1b0da2e4568b3df5efb /sysprep
parentac75e46c5a4d7c2e6330efd34f4c5a2a0bc71fe5 (diff)
downloadlibguestfs-23f8cab1e85fd77b053cc880d31687261c81e357.tar.gz
libguestfs-23f8cab1e85fd77b053cc880d31687261c81e357.tar.xz
libguestfs-23f8cab1e85fd77b053cc880d31687261c81e357.zip
sysprep: Remove the data of dovecot
Remove the data of dovecot. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Diffstat (limited to 'sysprep')
-rw-r--r--sysprep/Makefile.am2
-rw-r--r--sysprep/sysprep_operation_dovecot_data.ml43
2 files changed, 45 insertions, 0 deletions
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