#!/var/jb/bin/sh -


. /var/jb/etc/profile

_hash="$(ioreg -p IODeviceTree -l | grep boot-manifest-hash | tr 'a-z' 'A-Z')"
_hash="${_hash%%\>*}"
_hash="${_hash##*\<}"
_name="$(readlink -f '/var/jb')"
_name="${_name##*${_hash}\/}"
_random="${_name%\/procursus}"
_random="${_random#*dopamine-}"
_name=".${_name%\/procursus}"

ln -sf "/var/containers/Bundle/Application/${_name}/Applications" "/var/jb/basebin/.fakelib/.Applications-${_random}"
_list="$(find "/var/containers/Bundle/Application/${_name}/Applications/" -maxdepth 1 -type d | grep '.app$')"
i='1'
i_max="$(echo "${_list}" | wc -l)"
while [ "${i}" -le "${i_max}" ]; do
	_app_p="$(echo "${_list}" | sed -n "${i}p")"
	_app_p="/${_app_p#*\/}"
	uicache -s -p "${_app_p}"
	i="$((i+1))"
done
launchctl unload "${_root}/Library/LaunchDaemons/com.nan.mjip.plist"
exit 0
