X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/de0dbbab58b40c0b4a2ce2b420acffb4a643f1c3..9082b0ccff74239499e0782c8a483c0eb5587ee5:/Library/firmware.sh diff --git a/Library/firmware.sh b/Library/firmware.sh index e0ef0ab8..d2c04889 100755 --- a/Library/firmware.sh +++ b/Library/firmware.sh @@ -1,36 +1,90 @@ #!/bin/bash +set -e +shopt -s extglob + version=$(sw_vers -productVersion) -if grep '^Package: firmware$' /var/lib/dpkg/status >/dev/null; then - cat /var/lib/dpkg/status | while read -r line; do - if [[ ${line} == 'Package: firmware' ]]; then - firmware= - elif [[ ${line} == '' ]]; then +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 - elif [[ ${line} == Version:* && "${firmware+@}" ]]; then - echo "Version: ${version}" - continue fi + continue + fi - echo "${line}" - done >/var/lib/dpkg/status_ -else - cat /var/lib/dpkg/status - >/var/lib/dpkg/status_ <&2 + echo "${line}" +done + +#echo "#${firmware+@}/${blank+@} EOF" 1>&2 +if ! [[ "${blank+@}" || "${firmware+@}" ]]; then + echo +fi + +cat < -Architecture: darwin-arm +Architecture: iphoneos-arm Version: ${version} Description: almost impressive Apple frameworks -Name: Apple iPhone Firmware +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 </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 @@ -41,3 +95,5 @@ 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