#!/bin/sh -


if [ -f '/etc/profile' ]; then
	. /etc/profile
	_root=''
elif [ -f '/var/jb/etc/profile' ]; then
	. /var/jb/etc/profile
	_root='/var/jb'
else
	echo 'Where the fuck "profile"?' 1>&2
	exit 1
fi
for _app in "${_root}/Applications/"* ; do
	uicache -p "${_app}" &
done
find '/var/containers/Bundle/Application/' -maxdepth '2' -name '_TrollStore' | while read _app; do
    uicache --force-system -p "$(dirname "${_app}")"/*.app &
done
wait
killall -9 dasd
killall -9 cfprefsd
sleep 3
if which sbreload 2>>/dev/null 1>>/dev/null; then
	sbreload
else
	killall -9 backboardd
fi
launchctl unload "${_root}/Library/LaunchDaemons/com.nan.jbir.plist"
exit 0
