]> git.saurik.com Git - winterboard.git/blob - preinst
Don't crash when _UIImageWithName(NULL).
[winterboard.git] / preinst
1 #!/bin/bash
2
3 declare -a cydia
4 cydia=($CYDIA)
5
6 if [[ $1 == install ]]; then
7 /usr/libexec/cydia/move.sh /Library/Themes
8
9 if [[ ${CYDIA+@} ]]; then
10 eval "echo 'finish:restart' >&${cydia[0]}"
11 fi
12 elif [[ $1 == upgrade ]]; then
13 if [[ -e /Applications/WinterBoard.app/pledit ]]; then
14 /Applications/WinterBoard.app/pledit /System/Library/LaunchDaemons/com.apple.SpringBoard.plist \
15 -r /Applications/WinterBoard.app/WinterBoard.dylib
16 if [[ ${CYDIA+@} ]]; then
17 eval "echo 'finish:reload' >&${cydia[0]}"
18 fi
19 else
20 if [[ ${CYDIA+@} ]]; then
21 eval "echo 'finish:restart' >&${cydia[0]}"
22 fi
23 fi
24 fi
25
26 if [[ $1 == install || $1 == upgrade ]]; then
27 chmod 755 /Library/Themes/
28
29 {
30 grep -v ' com\.saurik\.winterboard\.' /etc/notify.conf
31 cat <<EOF
32 reserve com.saurik.winterboard. 0 0 rwr-r-
33 monitor com.saurik.winterboard.lockbackground /var/mobile/Library/LockBackground.jpg
34 monitor com.saurik.winterboard.lockbackground /var/mobile/Library/HomeBackground.jpg
35 EOF
36 } >/etc/notify.conf_ &&
37 chmod --reference=/etc/notify.conf /etc/notify.conf_ &&
38 chown --reference=/etc/notify.conf /etc/notify.conf_ &&
39 mv -f /etc/notify.conf{_,} || rm -f /etc/notify.conf_
40 fi
41
42 exit 0