]> git.saurik.com Git - cydia.git/blob - Library/firmware.sh
Bootstrap the firmware script on start.
[cydia.git] / Library / firmware.sh
1 #!/bin/bash
2
3 version=$(sw_vers -productVersion)
4
5 if grep '^Package: firmware$' /var/lib/dpkg/status >/dev/null; then
6 cat /var/lib/dpkg/status | while read -r line; do
7 if [[ ${line} == 'Package: firmware' ]]; then
8 firmware=
9 elif [[ ${line} == '' ]]; then
10 unset firmware
11 elif [[ ${line} == Version:* && "${firmware+@}" ]]; then
12 echo "Version: ${version}"
13 continue
14 fi
15
16 echo "${line}"
17 done >/var/lib/dpkg/status_
18 else
19 cat /var/lib/dpkg/status - >/var/lib/dpkg/status_ <<EOF
20 Package: firmware
21 Essential: yes
22 Status: install ok installed
23 Priority: required
24 Section: System
25 Installed-Size: 0
26 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
27 Architecture: darwin-arm
28 Version: ${version}
29 Description: almost impressive Apple frameworks
30 Name: Apple iPhone Firmware
31
32 EOF
33 fi && mv -f /var/lib/dpkg/status{_,}
34
35 if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then
36 user=root
37 else
38 user=mobile
39 fi
40
41 if [[ ! -h /User && -d /User ]]; then
42 cp -afT /User /var/"${user}"
43 fi && rm -rf /User && ln -s "/var/${user}" /User