summaryrefslogtreecommitdiff
path: root/Library/firmware.sh
blob: d2c048898d29c9392e7736ed292d5141cebe4921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash

set -e
shopt -s extglob

version=$(sw_vers -productVersion)

cat /var/lib/dpkg/status | {

while IFS= read -r line; do
    #echo "#${firmware+@}/${blank+@} ${line}" 1>&2

    if [[ ${line} == '' && "${blank+@}" ]]; then
        continue
    else
        unset blank
    fi

    if [[ ${line} == "Package: "@(firmware|gsc.*) ]]; then
        firmware=
    elif [[ ${line} == '' ]]; then
        blank=
    fi

    if [[ "${firmware+@}" ]]; then
        if [[ "${blank+@}" ]]; then
            unset firmware
        fi
        continue
    fi

    #echo "${firmware+@}/${blank+@} ${line}" 1>&2
    echo "${line}"
done

#echo "#${firmware+@}/${blank+@} EOF" 1>&2
if ! [[ "${blank+@}" || "${firmware+@}" ]]; then
    echo
fi

cat <<EOF
Package: firmware
Essential: yes
Status: install ok installed
Priority: required
Section: System
Installed-Size: 0
Architecture: iphoneos-arm
Version: ${version}
Description: almost impressive Apple frameworks
Name: iPhone Firmware
Tag: role::cydia

EOF

echo "/." >/var/lib/dpkg/info/firmware.list

gssc 2>&1 | sed -re '
    /^    [^ ]* = [0-9.]*;$/ ! d;
    s/^    ([^ ]*) = ([0-9.]*);$/\1 \2/;
    s/([A-Z])/-\L\1/g; s/^"([^ ]*)"/\1/;
    s/^-//;
    / 0$/ d;
' | while read -r name value; do

cat <<EOF
Package: gsc.${name}
Essential: yes
Status: install ok installed
Priority: required
Section: System
Installed-Size: 0
Architecture: iphoneos-arm
Version: ${value}
Description: GraphicsService Capability Bit
Name: GSC: ${name}
Tag: role::cydia

EOF

echo "/." >/var/lib/dpkg/info/gsc."${name}".list

done

} >/var/lib/dpkg/status_

mv -f /var/lib/dpkg/status{_,}

if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then
    user=root
else
    user=mobile
fi

if [[ ! -h /User && -d /User ]]; then
    cp -afT /User /var/"${user}"
fi && rm -rf /User && ln -s "/var/${user}" /User

echo 2 >/var/lib/cydia/firmware.ver