summaryrefslogtreecommitdiffstats
path: root/clone
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-10-14 08:36:00 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-10-14 08:36:00 +0100
commitc019d073a4f218b538d5176500b014e83dbce84f (patch)
tree8b075be0a91bfdb5635d7afdf9465a2e60f3d1bf /clone
parent05c26a9c099fe7616c95daaa3d473ee23f93e1b1 (diff)
downloadlibguestfs-c019d073a4f218b538d5176500b014e83dbce84f.tar.gz
libguestfs-c019d073a4f218b538d5176500b014e83dbce84f.tar.xz
libguestfs-c019d073a4f218b538d5176500b014e83dbce84f.zip
virt-sysprep: Add cron-spool, mail-spool, utmp.
Diffstat (limited to 'clone')
-rw-r--r--clone/virt-sysprep.in22
-rwxr-xr-xclone/virt-sysprep.pod16
2 files changed, 38 insertions, 0 deletions
diff --git a/clone/virt-sysprep.in b/clone/virt-sysprep.in
index 12c55bc0..144bad42 100644
--- a/clone/virt-sysprep.in
+++ b/clone/virt-sysprep.in
@@ -131,43 +131,52 @@ done
# enable all of these, although some of them are only done on certain
# guest types (see details below).
if [ -z "$enable" ]; then
+ cron_spool=yes
dhcp_client_state=yes
dhcp_server_state=yes
hostname=yes
logfiles=yes
+ mail_spool=yes
net_hwaddr=yes
random_seed=yes
rhn_systemid=yes
smolt_uuid=yes
ssh_hostkeys=yes
udev_persistent_net=yes
+ utmp=yes
yum_uuid=yes
elif [ "$enable" = "list" ]; then
+ echo "cron-spool"
echo "dhcp-client-state"
echo "dhcp-server-state"
echo "hostname"
echo "logfiles"
+ echo "mail-spool"
echo "net-hwaddr"
echo "random-seed"
echo "rhn-systemid"
echo "smolt-uuid"
echo "ssh-hostkeys"
echo "udev-persistent-net"
+ echo "utmp"
echo "yum-uuid"
exit 0
else
for opt in $(echo "$enable" | sed 's/,/ /g'); do
case "$opt" in
+ cron-spool) cron_spool=yes ;;
dhcp-client-state) dhcp_client_state=yes ;;
dhcp-server-state) dhcp_server_state=yes ;;
hostname) hostname=yes ;;
logfiles) logfiles=yes ;;
+ mail-spool) mail_spool=yes ;;
net-hwaddr) net_hwaddr=yes ;;
random-seed) random_seed=yes ;;
rhn-systemid) rhn_systemid=yes ;;
smolt-uuid) smolt_uuid=yes ;;
ssh-hostkeys) ssh_hostkeys=yes ;;
udev-persistent-net) udev_persistent_net=yes ;;
+ utmp) utmp=yes ;;
yum-uuid) yum_uuid=yes ;;
*)
echo "error: unknown --enable feature: $opt"
@@ -240,6 +249,10 @@ mnt="$tmpdir/mnt"
#----------------------------------------------------------------------
# The sysprep operations.
+if [ "$cron_spool" = "yes" ]; then
+ rm -rf $mnt/var/spool/cron/*
+fi
+
if [ "$dhcp_client_state" = "yes" ]; then
case "$type" in
linux)
@@ -293,6 +306,11 @@ if [ "$logfiles" = "yes" ]; then
esac
fi
+if [ "$mail_spool" = "yes" ]; then
+ rm -rf $mnt/var/spool/mail/*
+ rm -rf $mnt/var/mail/*
+fi
+
if [ "$net_hwaddr" = "yes" ]; then
case "$type/$distro" in
linux/fedora)
@@ -344,6 +362,10 @@ if [ "$udev_persistent_net" = "yes" -a "$type" = "linux" ]; then
rm -f $mnt/etc/udev/rules.d/70-persistent-net.rules
fi
+if [ "$utmp" = "yes" -a "$type" != "windows" ]; then
+ rm -f $mnt/var/run/utmp
+fi
+
if [ "$yum_uuid" = "yes" -a "$package_management" = "yum" ]; then
rm -f $mnt/var/lib/yum/uuid
fi
diff --git a/clone/virt-sysprep.pod b/clone/virt-sysprep.pod
index eb5c430c..bdd0dfd1 100755
--- a/clone/virt-sysprep.pod
+++ b/clone/virt-sysprep.pod
@@ -171,6 +171,10 @@ Future versions of virt-sysprep may add more operations. If you are
using virt-sysprep and want predictable behaviour, specify only the
operations that you want to have enabled.
+=head2 cron-spool
+
+Remove user at-jobs and cron-jobs.
+
=head2 dhcp-client-state
Remove DHCP client leases.
@@ -191,6 +195,10 @@ changed to C<localhost.localdomain>.
Remove many log files.
+=head2 mail-spool
+
+Remove email from the local mail spool directory.
+
=head2 net-hwaddr
Remove HWADDR (hard-coded MAC address) configuration. For Fedora and
@@ -236,6 +244,14 @@ old MAC address occupies the old name (eg. eth0), this means the fresh
MAC address is assigned to a new name (eg. eth1) and this is usually
undesirable. Erasing the udev persistent net rules avoids this.
+=head2 utmp
+
+Remove the utmp file.
+
+This records who is currently logged in on a machine. In modern Linux
+distros it is stored in a ramdisk and hence not part of the virtual
+machine's disk, but it was stored on disk in older distros.
+
=head2 yum-uuid
Remove the yum UUID.