]> git.saurik.com Git - cydia.git/blame_incremental - Library/firmware.sh
Checkpoint before UICaboodle reorganzation.
[cydia.git] / Library / firmware.sh
... / ...
CommitLineData
1#!/bin/bash
2set -e
3
4version=$(sw_vers -productVersion)
5
6cat /var/lib/dpkg/status | {
7
8while 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}"
32done
33
34#echo "#${firmware+@}/${blank+@} EOF" 1>&2
35if ! [[ "${blank+@}" || "${firmware+@}" ]]; then
36 echo
37fi
38
39cat <<EOF
40Package: firmware
41Essential: yes
42Status: install ok installed
43Priority: required
44Section: System
45Installed-Size: 0
46Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
47Architecture: iphoneos-arm
48Version: ${version}
49Description: almost impressive Apple frameworks
50Name: iPhone Firmware
51
52EOF
53
54} >/var/lib/dpkg/status_
55
56mv -f /var/lib/dpkg/status{_,}
57
58echo "/." >/var/lib/dpkg/info/firmware.list
59
60if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then
61 user=root
62else
63 user=mobile
64fi
65
66if [[ ! -h /User && -d /User ]]; then
67 cp -afT /User /var/"${user}"
68fi && rm -rf /User && ln -s "/var/${user}" /User