5 export DEBIAN_FRONTEND=noninteractive
7 # Finally, cleanup all the things
8 apt-get install --yes deborphan # Let's try to remove some more
21 # Remove downloaded .deb files
24 # Remove instance-specific files: we want this image to be as "impersonal" as
31 -mindepth 1 -print -delete
34 /etc/network/interfaces.d/50-cloud-init.cfg \
39 /var/cache/ldconfig/aux-cache \
40 /var/lib/systemd/random-seed \
42 "${SUDO_USER}/.bash_history"
44 # From https://www.freedesktop.org/software/systemd/man/machine-id.html:
45 # For operating system images which are created once and used on multiple
46 # machines, [...] /etc/machine-id should be an empty file in the generic file
48 truncate -s 0 /etc/machine-id
50 # Recreate some useful files.
51 touch /var/log/lastlog
52 chown root:utmp /var/log/lastlog
53 chmod 664 /var/log/lastlog
56 # Free all unused storage block. This makes the final image smaller.
57 fstrim --all --verbose