#!/bin/sh
echo "Uninstalling csf and lfd..."
echo

sed -i 's/lfd=ON/lfd=OFF/' /usr/local/directadmin/data/admin/services.status

perl /etc/csf/csf.pl -f
/etc/init.d/lfd stop

if [ -f /etc/debian_version ] || [ -f /etc/lsb-release ]; then
	update-rc.d -f lfd remove
	update-rc.d -f csf remove
elif [ -f /etc/gentoo-release ]; then
	rc-update del lfd default
	rc-update del csf default
else
	/sbin/chkconfig csf off
	/sbin/chkconfig lfd off
	/sbin/chkconfig csf --del
	/sbin/chkconfig lfd --del
fi
rm -fv /etc/init.d/csf
rm -fv /etc/init.d/lfd
rm -fv /etc/chkserv.d/lfd
rm -fv /usr/sbin/csf
rm -fv /usr/sbin/lfd
rm -fv /etc/cron.d/csf_update
rm -fv /etc/cron.d/lfdcron.sh
rm -fv /etc/cron.d/csfcron.sh
rm -Rfv /usr/local/directadmin/plugins/csf
rm -fv /etc/logrotate.d/lfd

rm -Rfv /etc/csf
cd

echo
echo "...Done"
