#!/bin/bash
+
export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
+
+if [[ ! -e /var/lib/cydia/firmware.ver ]]; then
+ cache=
+fi
+
/usr/libexec/cydia/firmware.sh
-/usr/libexec/cydia/space.sh
-debs=/var/root/Media/Cydia/AutoInstall/*.deb
-dpkg -i ${debs}
-rm -f ${debs}
+
+debs=(/var/root/Media/Cydia/AutoInstall/*.deb)
+if [[ ${#debs[@]} -ne 0 && -f ${debs[0]} ]]; then
+ dpkg -i "${debs[@]}"
+ rm -f "${debs[@]}"
+ cache=
+
+ killall -9 Lowtide AppleTV
+fi
+
+if [[ ${cache+@} ]]; then
+ su -c uicache mobile
+fi