]> git.saurik.com Git - cydia.git/blame - Library/firmware.sh
Commit (chpwn): essential-alerts.patch
[cydia.git] / Library / firmware.sh
CommitLineData
de0dbbab 1#!/bin/bash
5ec44e34 2
12762dfa 3set -e
5ec44e34 4shopt -s extglob
de0dbbab
JF
5
6version=$(sw_vers -productVersion)
7
4825688a
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
5ec44e34 19 if [[ ${line} == "Package: "@(firmware|gsc.*) ]]; then
12762dfa
JF
20 firmware=
21 elif [[ ${line} == '' ]]; then
4825688a
JF
22 blank=
23 fi
24
25 if [[ "${firmware+@}" ]]; then
26 if [[ "${blank+@}" ]]; then
27 unset firmware
28 fi
12762dfa
JF
29 continue
30 fi
31
4825688a 32 #echo "${firmware+@}/${blank+@} ${line}" 1>&2
12762dfa 33 echo "${line}"
4825688a 34done
12762dfa 35
4825688a
JF
36#echo "#${firmware+@}/${blank+@} EOF" 1>&2
37if ! [[ "${blank+@}" || "${firmware+@}" ]]; then
38 echo
39fi
40
41cat <<EOF
de0dbbab
JF
42Package: firmware
43Essential: yes
44Status: install ok installed
45Priority: required
46Section: System
47Installed-Size: 0
12762dfa 48Architecture: iphoneos-arm
de0dbbab
JF
49Version: ${version}
50Description: almost impressive Apple frameworks
7e8e5d66 51Name: iPhone Firmware
5ec44e34
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
de0dbbab
JF
78
79EOF
12762dfa 80
5ec44e34
JF
81echo "/." >/var/lib/dpkg/info/gsc."${name}".list
82
83done
84
4825688a
JF
85} >/var/lib/dpkg/status_
86
12762dfa 87mv -f /var/lib/dpkg/status{_,}
de0dbbab
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
5ec44e34 98
daf7f6e2 99echo 2 >/var/lib/cydia/firmware.ver