]>
Commit | Line | Data |
---|---|---|
1ca3a01a | 1 | #!/bin/bash |
01d93940 | 2 | |
a6147124 | 3 | set -e |
01d93940 | 4 | shopt -s extglob |
1ca3a01a JF |
5 | |
6 | version=$(sw_vers -productVersion) | |
7 | ||
ea173384 JF |
8 | cat /var/lib/dpkg/status | { |
9 | ||
10 | while IFS= read -r line; do | |
11 | #echo "#${firmware+@}/${blank+@} ${line}" 1>&2 | |
12 | ||
13 | if [[ ${line} == '' && "${blank+@}" ]]; then | |
14 | continue | |
15 | else | |
16 | unset blank | |
17 | fi | |
18 | ||
01d93940 | 19 | if [[ ${line} == "Package: "@(firmware|gsc.*) ]]; then |
a6147124 JF |
20 | firmware= |
21 | elif [[ ${line} == '' ]]; then | |
ea173384 JF |
22 | blank= |
23 | fi | |
24 | ||
25 | if [[ "${firmware+@}" ]]; then | |
26 | if [[ "${blank+@}" ]]; then | |
27 | unset firmware | |
28 | fi | |
a6147124 JF |
29 | continue |
30 | fi | |
31 | ||
ea173384 | 32 | #echo "${firmware+@}/${blank+@} ${line}" 1>&2 |
a6147124 | 33 | echo "${line}" |
ea173384 | 34 | done |
a6147124 | 35 | |
ea173384 JF |
36 | #echo "#${firmware+@}/${blank+@} EOF" 1>&2 |
37 | if ! [[ "${blank+@}" || "${firmware+@}" ]]; then | |
38 | echo | |
39 | fi | |
40 | ||
41 | cat <<EOF | |
1ca3a01a JF |
42 | Package: firmware |
43 | Essential: yes | |
44 | Status: install ok installed | |
45 | Priority: required | |
46 | Section: System | |
47 | Installed-Size: 0 | |
a6147124 | 48 | Architecture: iphoneos-arm |
1ca3a01a JF |
49 | Version: ${version} |
50 | Description: almost impressive Apple frameworks | |
b88731cd | 51 | Name: iPhone Firmware |
01d93940 JF |
52 | Tag: role::cydia |
53 | ||
54 | EOF | |
55 | ||
56 | echo "/." >/var/lib/dpkg/info/firmware.list | |
57 | ||
58 | gssc 2>&1 | sed -re ' | |
59 | /^ [^ ]* = [0-9.]*;$/ ! d; | |
60 | s/^ ([^ ]*) = ([0-9.]*);$/\1 \2/; | |
61 | s/([A-Z])/-\L\1/g; s/^"([^ ]*)"/\1/; | |
62 | s/^-//; | |
63 | / 0$/ d; | |
64 | ' | while read -r name value; do | |
65 | ||
66 | cat <<EOF | |
67 | Package: gsc.${name} | |
68 | Essential: yes | |
69 | Status: install ok installed | |
70 | Priority: required | |
71 | Section: System | |
72 | Installed-Size: 0 | |
73 | Architecture: iphoneos-arm | |
74 | Version: ${value} | |
75 | Description: GraphicsService Capability Bit | |
76 | Name: GSC: ${name} | |
77 | Tag: role::cydia | |
1ca3a01a JF |
78 | |
79 | EOF | |
a6147124 | 80 | |
01d93940 JF |
81 | echo "/." >/var/lib/dpkg/info/gsc."${name}".list |
82 | ||
83 | done | |
84 | ||
ea173384 JF |
85 | } >/var/lib/dpkg/status_ |
86 | ||
a6147124 | 87 | mv -f /var/lib/dpkg/status{_,} |
1ca3a01a JF |
88 | |
89 | if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then | |
90 | user=root | |
91 | else | |
92 | user=mobile | |
93 | fi | |
94 | ||
95 | if [[ ! -h /User && -d /User ]]; then | |
96 | cp -afT /User /var/"${user}" | |
97 | fi && rm -rf /User && ln -s "/var/${user}" /User | |
01d93940 | 98 | |
77801ff1 | 99 | echo 2 >/var/lib/cydia/firmware.ver |