From 37572a548c1a9fd55a2d7dd051ed272af3e9f117 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 20 May 2015 11:24:17 +0200 Subject: [PATCH] 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 --- lib/img-functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/img-functions b/lib/img-functions index 4593a4680..83825a05f 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -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 () {