summaryrefslogtreecommitdiff
path: root/data/iphone-113su/iphone-113su
blob: 816920679ff8c4d43e6dacd9bf81f37173ee617b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash

# iPhone-113su - iPhone 1.1.3 Software Upgrade
# Copyright (C) 2008  Jay Freeman (saurik)
#
#        Redistribution and use in source and binary
# forms, with or without modification, are permitted
# provided that the following conditions are met:
# 
# 1. Redistributions of source code must retain the
#    above copyright notice, this list of conditions
#    and the following disclaimer.
# 2. Redistributions in binary form must reproduce the
#    above copyright notice, this list of conditions
#    and the following disclaimer in the documentation
#    and/or other materials provided with the
#    distribution.
# 3. The name of the author may not be used to endorse
#    or promote products derived from this software
#    without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Based on the Jailbreak released by planetbeing, NerveGas,
# ghost_000, dinopio, bgm, MuscleNerd, and the iPhone-Elite
# and iPhone/iTouch Dev teams. Some concepts were taken
# from natetrue's release. All binaries compiled separately,
# and different things are changed. This isn't quite the
# same upgrade process... remember that.

# Special thanks goes to francis and cromas, who pointed
# out things that were broken in other upgrades, helped
# choose paths when it came time for tradeoffs, and offered
# their phones and touches up for destruction to it.

shopt -s extglob nullglob
set -e -v

base=$(mktemp -d -t 113)
device=$(uname -m)

if [[ ${device} = iPod* ]]; then
    ipsw='iPod/SBML/osx/061-4060.20080115.9Iuh5/iPod1,1_1.1.3_4A93_Restore.ipsw'
    dmg='022-3742-100.dmg'
else
    ipsw='iPhone/061-4061.20080115.4Fvn7/iPhone1,1_1.1.3_4A93_Restore.ipsw'
    dmg='022-3743-100.dmg'
fi

wget -O "${base}/ipsw.zip" "http://appldnld.apple.com.edgesuite.net/content.info.apple.com/${ipsw}"
unzip -d "${base}/ipsw" "${base}/ipsw.zip"
rm -f "${base}/ipsw.zip"

vfdecrypt -i "${base}/ipsw/${dmg}" -k 11070c11d93b9be5069b643204451ed95aad37df7b332d10e48fd3d23c62fca517055816 -o "${base}/ipsw.dmg"
rm -rf "${base}/ipsw"

dmg2img -v "${base}/ipsw.dmg" "${base}/ipsw.img"
rm -f "${base}/ipsw.dmg"

/usr/libexec/vndevice attach /dev/vn0 "${base}/ipsw.img"
mount_hfs /dev/vn0 /mnt

( cd /mnt; rsync -SPaz . / \
    --exclude fstab \
    --exclude kernelcache.s5l8900xrb )

umount /mnt
/usr/libexec/vndevice detach /dev/vn0

patch /System/Library/Lockdown/Services.plist <<EOF
--- Services.plist	2007-12-15 04:03:50.000000000 +0000
+++ Services.plist	2008-01-25 20:27:36.000000000 +0000
@@ -18,6 +18,20 @@
 			<string>mobile</string>
 		</array>
 	</dict>
+	<key>com.apple.afc2</key>
+	<dict>
+		<key>AllowUnactivatedService</key>
+		<true/>
+		<key>Label</key>
+		<string>com.apple.afc2</string>
+		<key>ProgramArguments</key>
+		<array>
+			<string>/usr/libexec/afcd</string>
+			<string>--lockdown</string>
+			<string>-d</string>
+			<string>/</string>
+		</array>
+	</dict>
 	<key>com.apple.crashreportcopy</key>
 	<dict>
 		<key>AllowUnactivatedService</key>
EOF

xargs -d '\n' rm -f <<EOF
/Applications/Maps.app/PinSatDown1.png
/Applications/Maps.app/PinSatDown3.png
/Applications/Maps.app/PinSatFloating.png
/Applications/Maps.app/PinSatDown2.png
/Applications/Maps.app/Directions.png
/Applications/Maps.app/Traffic.png
/Applications/MobileSafari.app/StaticBookmarks-en_UK.plist
/private/var/root/Library/Preferences/.GlobalPreferences.plist
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_ATT.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_CINGULAR.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_ATT.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_O2-UK.png
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_Orange F.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_Orange.png
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_TIM.png
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_O2-UK.png
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_TMOBILE.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_TIM.png
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_CINGULAR.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_TMOBILE.png
/System/Library/CoreServices/SpringBoard.app/FSO_CARRIER_Orange.png
/System/Library/CoreServices/SpringBoard.app/Default_CARRIER_Orange F.png
/System/Library/Frameworks/CoreTelephony.framework/Support/310170
/System/Library/Frameworks/CoreTelephony.framework/Support/ATT_US.plist
/System/Library/Frameworks/CoreTelephony.framework/Support/O2_UK.plist
/System/Library/Frameworks/CoreTelephony.framework/Support/310380
/System/Library/Frameworks/CoreTelephony.framework/Support/310150
/System/Library/Frameworks/CoreTelephony.framework/Support/20802
/System/Library/Frameworks/CoreTelephony.framework/Support/26201
/System/Library/Frameworks/CoreTelephony.framework/Support/20808
/System/Library/Frameworks/CoreTelephony.framework/Support/310410
/System/Library/Frameworks/CoreTelephony.framework/Support/23410
/System/Library/Frameworks/CoreTelephony.framework/Support/311180
/System/Library/Frameworks/CoreTelephony.framework/Support/23402
/System/Library/Frameworks/CoreTelephony.framework/Support/Orange_France.plist
/System/Library/Frameworks/CoreTelephony.framework/Support/26206
/System/Library/Frameworks/CoreTelephony.framework/Support/TMobile_Germany.plist
/System/Library/Frameworks/CoreTelephony.framework/Support/310180
/System/Library/Frameworks/CoreTelephony.framework/Support/20801
/System/Library/Frameworks/CoreTelephony.framework/Support/310980
/System/Library/Frameworks/CoreTelephony.framework/Support/TIM_Italy.plist
/System/Library/Frameworks/CoreTelephony.framework/Support/22201
/System/Library/Frameworks/CoreTelephony.framework/Support/UnknownCarrier.plist
/System/Library/Frameworks/CoreTelephony.framework/Support/23411
EOF

rm -rf /System/Library/Frameworks/SystemConfiguration.framework/Versions

chmod a+x /Applications/Installer.app/Installer
chmod +s /Applications/Installer.app/Installer

if [[ ${device} != iPod* ]]; then
    ipatcher -l /usr/libexec/lockdownd
fi

mkdir /private/var/db/timezone
mv /private/var/db/localtime /private/var/db/timezone/localtime

mv /private/var/root/Library/Keychains /private/var/Keychains
chown -R 64:64 /private/var/Keychains

mv /private/var/preferences/* /private/var/root/Library/Preferences
rmdir /private/var/preferences
ln -s /private/var/root/Library/Preferences /private/var/preferences
chown -R 501:501 /private/var/root

if [[ ! -e /private/var/root/.forward ]]; then
    mv /private/var/mobile/.forward /private/var/root/
fi

touch /private/var/root/Library/.localized

rm -rf /private/var/mobile
ln -s /private/var/root /private/var/mobile

if [[ ${device} != iPod* ]]; then
    mkdir -p /private/var/logs/Baseband
    chmod a+rwx /private/var/logs/Baseband
fi

mkdir -p /private/var/logs/AppleSupport
chmod a+rwx /private/var/logs/AppleSupport

apt-get remove iphone-113su

reboot