]> git.saurik.com Git - cydia.git/blame - Library/firmware.sh
chpwn forgot something important.
[cydia.git] / Library / firmware.sh
CommitLineData
1ca3a01a 1#!/bin/bash
01d93940 2
a6147124 3set -e
01d93940 4shopt -s extglob
1ca3a01a
JF
5
6version=$(sw_vers -productVersion)
7
ea173384
JF
8cat /var/lib/dpkg/status | {
9
10while 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 34done
a6147124 35
ea173384
JF
36#echo "#${firmware+@}/${blank+@} EOF" 1>&2
37if ! [[ "${blank+@}" || "${firmware+@}" ]]; then
38 echo
39fi
40
41cat <<EOF
1ca3a01a
JF
42Package: firmware
43Essential: yes
44Status: install ok installed
45Priority: required
46Section: System
47Installed-Size: 0
a6147124 48Architecture: iphoneos-arm
1ca3a01a
JF
49Version: ${version}
50Description: almost impressive Apple frameworks
b88731cd 51Name: iPhone Firmware
01d93940
JF
52Tag: role::cydia
53
54EOF
55
56echo "/." >/var/lib/dpkg/info/firmware.list
57
58gssc 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
66cat <<EOF
67Package: gsc.${name}
68Essential: yes
69Status: install ok installed
70Priority: required
71Section: System
72Installed-Size: 0
73Architecture: iphoneos-arm
74Version: ${value}
75Description: GraphicsService Capability Bit
76Name: GSC: ${name}
77Tag: role::cydia
1ca3a01a
JF
78
79EOF
a6147124 80
01d93940
JF
81echo "/." >/var/lib/dpkg/info/gsc."${name}".list
82
83done
84
ea173384
JF
85} >/var/lib/dpkg/status_
86
a6147124 87mv -f /var/lib/dpkg/status{_,}
1ca3a01a
JF
88
89if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then
90 user=root
91else
92 user=mobile
93fi
94
95if [[ ! -h /User && -d /User ]]; then
96 cp -afT /User /var/"${user}"
97fi && rm -rf /User && ln -s "/var/${user}" /User
01d93940 98
77801ff1 99echo 2 >/var/lib/cydia/firmware.ver