]> git.saurik.com Git - cydia.git/blob - Library/firmware.sh
Major modifications to ready for stability.
[cydia.git] / Library / firmware.sh
1 #!/bin/bash
2 set -e
3
4 version=$(sw_vers -productVersion)
5
6 cat /var/lib/dpkg/status | {
7
8 while IFS= read -r line; do
9 #echo "#${firmware+@}/${blank+@} ${line}" 1>&2
10
11 if [[ ${line} == '' && "${blank+@}" ]]; then
12 continue
13 else
14 unset blank
15 fi
16
17 if [[ ${line} == 'Package: firmware' ]]; then
18 firmware=
19 elif [[ ${line} == '' ]]; then
20 blank=
21 fi
22
23 if [[ "${firmware+@}" ]]; then
24 if [[ "${blank+@}" ]]; then
25 unset firmware
26 fi
27 continue
28 fi
29
30 #echo "${firmware+@}/${blank+@} ${line}" 1>&2
31 echo "${line}"
32 done
33
34 #echo "#${firmware+@}/${blank+@} EOF" 1>&2
35 if ! [[ "${blank+@}" || "${firmware+@}" ]]; then
36 echo
37 fi
38
39 cat <<EOF
40 Package: firmware
41 Essential: yes
42 Status: install ok installed
43 Priority: required
44 Section: System
45 Installed-Size: 0
46 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
47 Architecture: iphoneos-arm
48 Version: ${version}
49 Description: almost impressive Apple frameworks
50 Name: iPhone Firmware
51
52 EOF
53
54 } >/var/lib/dpkg/status_
55
56 mv -f /var/lib/dpkg/status{_,}
57
58 echo "/." >/var/lib/dpkg/info/firmware.list
59
60 if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then
61 user=root
62 else
63 user=mobile
64 fi
65
66 if [[ ! -h /User && -d /User ]]; then
67 cp -afT /User /var/"${user}"
68 fi && rm -rf /User && ln -s "/var/${user}" /User