This remove the NFS settings by removing /etc/export.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
sysprep/Makefile.am | 1 +
sysprep/sysprep_operation_nfs_setting.ml | 43 ++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 sysprep/sysprep_operation_nfs_setting.ml
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index b89345a..9894baf 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -51,6 +51,7 @@ operations = \
mail_spool \
net_hostname \
net_hwaddr \
+ nfs_setting \
pacct_log \
package_manager_cache \
pam_data \
diff --git a/sysprep/sysprep_operation_nfs_setting.ml
b/sysprep/sysprep_operation_nfs_setting.ml
new file mode 100644
index 0000000..6d74cba
--- /dev/null
+++ b/sysprep/sysprep_operation_nfs_setting.ml
@@ -0,0 +1,43 @@
+(* virt-sysprep
+ * Copyright (C) 2013 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
+open Common_gettext.Gettext
+
+module G = Guestfs
+
+let nfs_setting_perform g root =
+ let typ = g#inspect_get_type root in
+ if typ <> "windows" then (
+ let path = "/etc/export" in
+ (try g#rm path with G.Error _ -> ());
+ []
+ )
+ else []
+
+let op = {
+ defaults with
+ name = "NFS-setting";
+ enabled_by_default = false;
+ heading = s_"Remove the NFS settings";
+ pod_description = Some (s_"\
+This removes the NFS settings by removing C</etc/export>.");
+ perform_on_filesystems = Some nfs_setting_perform;
+}
+
+let () = register_operation op
--
1.8.4.27.g0a41de8