#! /bin/sh
PATH="/usr/bin:/bin:/usr/sbin:/sbin"

cd /Library/LaunchDaemons
if [ -f xxx.qnation.PeerProtector.kextload.plist ]; then
	echo "Removing Launch Daemon plist..."
	rm ./xxx.qnation.PeerProtector.kextload.plist 
fi

cd ../Extensions
if [ -d ./PeerProtector.kext ]; then
	echo "Unloading kext..."
	/Library/Application\ Support/ppktool -u
	echo "Removing PP kext..."
	rm -rf ./PeerProtector.kext
fi

cd ../Receipts
if [ -d ./PeerProtector.pkg ]; then
	echo "Removing Install receipt..."
	rm -rf ./PeerProtector.pkg
fi

cd ../Widgets
if [ -d ./PeerProtector.wdgt ]; then
	echo "Removing widget..."
	rm -rf ./PeerProtector.wdgt
fi

# User specific
cd "${HOME}"/Library/Caches
if [ -d xxx.qnation.PeerProtector ]; then
	echo "Renaming list cache"
	mv ./xxx.qnation.PeerProtector ./xxx.qnation.PeerGuardian
fi

if [ -d ../Widgets ]; then
	cd ../Widgets
	if [ -d ./PeerProtector.wdgt ]; then
		echo "Removing widget..."
		rm -rf ./PeerProtector.wdgt
	fi
fi
