Skip to content

Instantly share code, notes, and snippets.

@NewFuture
Last active August 1, 2016 02:19
Show Gist options
  • Save NewFuture/0c3f5c38fae057d055ddd8b09e053387 to your computer and use it in GitHub Desktop.
Save NewFuture/0c3f5c38fae057d055ddd8b09e053387 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Remove Postfix
systemctl stop postfix
systemctl disable postfix
yum remove -y postfix
# Remove Linux headers
yum -y remove *firmware avahi-autoipd avahi-libs avahi bluez-utils kudzu alsa-lib fxload rdma man-db microcode_ctl NetworkManager-team
yum clean all
# Next time yum will retrieve new list of mirrors & stuff
rm -rf /var/cache/yum
# Remove Virtualbox specific files
rm -rf /usr/src/vboxguest* /usr/src/virtualbox-ose-guest*
rm -rf *.iso *.iso.? /tmp/vbox /home/vagrant/.vbox_version
# Cleanup log files
find /var/log -type f | while read f; do echo -ne '' > $f; done;
# remove under tmp directory
rm -rf /tmp/*
# remove interface persistent
rm -f /etc/udev/rules.d/70-persistent-net.rules
for ifcfg in $(ls /etc/sysconfig/network-scripts/ifcfg-*)
do
if [ "$(basename ${ifcfg})" != "ifcfg-lo" ]
then
sed -i '/^UUID/d' /etc/sysconfig/network-scripts/ifcfg-enp0s3
sed -i '/^HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-enp0s3
fi
done
echo 'Zeroing empty space ...'
dd if=/dev/zero of=/EMPTY bs=1M
rm -rf /EMPTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment