X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/5e563e7947608ea840bcff380883a7b70aeef2f4..3d3f46666b0fc612216bb841c3ba31eff641d49b:/Library/firmware.sh diff --git a/Library/firmware.sh b/Library/firmware.sh index 3edf8d08..e91eef34 100755 --- a/Library/firmware.sh +++ b/Library/firmware.sh @@ -1,27 +1,42 @@ #!/bin/bash +set -e -# XXX: FIX THIS!! -architecture=iphoneos-arm version=$(sw_vers -productVersion) -if grep '^Package: firmware$' /var/lib/dpkg/status >/dev/null; then - cat /var/lib/dpkg/status | while IFS= 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' ]]; then + firmware= + elif [[ ${line} == '' ]]; then + blank= + fi + + if [[ "${firmware+@}" ]]; then + if [[ "${blank+@}" ]]; then unset firmware - elif [[ ${line} == Architecture:* && "${firmware+@}" ]]; then - echo "Architecture: ${architecture}" - continue - 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: ${architecture} +Architecture: iphoneos-arm Version: ${version} Description: almost impressive Apple frameworks Name: iPhone Firmware EOF -fi && mv -f /var/lib/dpkg/status{_,} + +} >/var/lib/dpkg/status_ + +mv -f /var/lib/dpkg/status{_,} echo "/." >/var/lib/dpkg/info/firmware.list