Cleanup /tmp in the guest

Clean all the content in the /tmp directory of the guest, leaving the
directory itself (usually has special attributes).

Modern distributions usually either setup a tmpfs on /tmp, or clean it
at every boot, so the leftovers will be just few bytes in the generated
image.
Regarding other distributions, a clean /tmp at their first boot will
surely not be a bad idea anyway.

Change-Id: I2b0f8864bc4909542d924f5bd9296dca5d0189f2
This commit is contained in:
Pino Toscano 2015-05-20 11:24:17 +02:00
parent 76f64ae0da
commit 37572a548c

View File

@ -106,6 +106,9 @@ function finalise_base () {
sudo mv $TMP_MOUNT_PATH/etc/resolv.conf.ORIG $TMP_MOUNT_PATH/etc/resolv.conf
fi
fi
# Cleanup /tmp in the guest, so there is less cruft left there
unmount_dir $TMP_MOUNT_PATH/tmp
find $TMP_MOUNT_PATH/tmp -maxdepth 1 -mindepth 1 | xargs sudo rm -rf --one-file-system
}
function compress_and_save_image () {