#!/bin/bash
# karen was here o u o
if [[ $EUID -ne 0 ]]; then
	echo "This tool must be run as root."
	exit 1
fi
chmod 777 /bin/ppsync.dylib
chmod 777 /usr/bin/karen_clean_changeinstalld
echo Fixing permissions...
/usr/bin/karen_clean_changeinstalld "uninstall"
echo Invoking changeinstalld uninstallation procedure...
launchctl unload /System/Library/LaunchDaemons/com.apple.mobile.installd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.mobile.installd.plist
echo Reloading installd...
# rm -f /User/Library/Caches/com.apple.mobile.installation.plist
# rm -f /User/Library/Caches/com.apple.LaunchServices-*.csstore
rm -f /usr/bin/changeinstalld
rm -f /bin/ppsync.dylib
echo Deleting all PPSync-related files...
echo Cleaning up after PanGu...
cp /Library/CompletePPSyncRemover/com.apple.mobile.installd.plist /Library/LaunchDaemons/com.apple.mobile.installd.plist
echo Done.
echo Rebooting device...
reboot
