31 lines
739 B
Bash
31 lines
739 B
Bash
|
#!/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
|