#! /bin/bash

rm -f $target/etc/mailname \
      $target/etc/machine-id \
      $target/etc/apt/sources.list.d/localdebs.list \
      $target/usr/bin/qemu-*-static \
      $target/var/lib/dbus/machine-id \
      $target/var/log/alternatives.log \
      $target/var/log/apt/* \
      $target/var/log/bootstrap.log \
      $target/var/log/dpkg.log \
      $target/var/log/install_packages.list

# If $target/etc/resolv.conf is a link it is probably managed by some
# management software (e.g. resolvconf, systemd-resolvd,
# NetworkManager) and should stay in place.
if [ ! -L $target/etc/resolv.conf ]
then
    rm -f $target/etc/resolv.conf
fi

rm -rf $target/var/cache/apt/*
rm -rf $target/var/lib/apt/lists/*
rm -rf $target/var/log/fai
rm -f $target/var/lib/dpkg/available*

touch $target/etc/machine-id
touch $target/var/lib/dpkg/available

shred --remove $target/etc/ssh/ssh_host_*

fstrim $target
