You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
box-o-sand/selinux/base-box-wipe.sh

31 lines
739 B

#!/bin/bash
set -ex
rm -rf /usr/portage /usr/src /tmp/* /var/tmp/*
dd if=/dev/zero of=/EMPTY bs=1M || true
rm -f /EMPTY
unset HISTFILE
rm -f /root/.bash_history
rm -f /home/vagrant/.bash_history
find /var/log -type f | while read f; do echo -ne '' > $f; done
count=`df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}'`
let count--
dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count || true
rm /tmp/whitespace
count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'`
let count--
dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count || true
rm /boot/whitespace
swappart=`cat /proc/swaps | tail -n1 | awk -F ' ' '{print $1}'`
swapoff $swappart
dd if=/dev/zero of=$swappart || true
mkswap $swappart
swapon $swappart