X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/fda0e863fd40edba13706020957933243c6e59f1..cb6e2ccf1e636ee709c709d68b379efe14540303:/Library/firmware.sh diff --git a/Library/firmware.sh b/Library/firmware.sh index ee8e26a3..53543ba9 100755 --- a/Library/firmware.sh +++ b/Library/firmware.sh @@ -1,45 +1,143 @@ #!/bin/bash -version=$(sw_vers -productVersion) +set -e -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 - unset firmware - elif [[ ${line} == Version:* && "${firmware+@}" ]]; then - echo "Version: ${version}" - continue - fi +shopt -s extglob +shopt -s nullglob - echo "${line}" - done >/var/lib/dpkg/status_ +version=$(sw_vers -productVersion) +cpu=$(uname -p) + +if [[ ${cpu} == arm ]]; then + data=/var/lib/dpkg + model=hw.machine + arch=iphoneos-arm else - cat /var/lib/dpkg/status - >/var/lib/dpkg/status_ <"${data}"/info/"${package}".list + + cat < -Architecture: darwin-arm +Architecture: ${arch} Version: ${version} -Description: almost impressive Apple frameworks -Name: Apple iPhone Firmware - +Description: ${description} +Tag: role::cydia EOF -fi && mv -f /var/lib/dpkg/status{_,} -echo "/." >/var/lib/dpkg/info/firmware.list + [[ -n ${name} ]] && echo "Name: ${name}" + echo +} +# }}} -if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then - user=root -else - user=mobile -fi +{ + +# Delete Old Packages {{{ + unset firmware + unset blank + + while IFS= read -r line; do + #echo "#${firmware+@}/${blank+@} ${line}" 1>&2 + + if [[ ${line} == '' && "${blank+@}" ]]; then + continue + else + unset blank + fi -if [[ ! -h /User && -d /User ]]; then - cp -afT /User /var/"${user}" -fi && rm -rf /User && ln -s "/var/${user}" /User + if [[ ${line} == "Package: "@(firmware|gsc.*|cy+*) ]]; 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 <"${status}" + + #echo "#${firmware+@}/${blank+@} EOF" 1>&2 + if ! [[ "${blank+@}" || "${firmware+@}" ]]; then + echo + fi +# }}} + + if [[ ${cpu} == arm ]]; then + pseudo "firmware" "${version}" "almost impressive Apple frameworks" + + while [[ 1 ]]; do + gssc=$(gssc 2>&1) + if [[ ${gssc} != *'(null)'* ]]; then + break + fi + sleep 1 + done + + echo "${gssc}" | 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 + pseudo "gsc.${name}" "${value}" "virtual GraphicsServices dependency" + + if [[ ${name} == ipad ]]; then + pseudo "gsc.wildcat" "${value}" "virtual virtual GraphicsServices dependency" + fi + done + fi + + if [[ ${cpu} == arm ]]; then + os=ios + else + os=macosx + fi + + pseudo "cy+os.${os}" "${version}" "virtual operating system dependency" + pseudo "cy+cpu.${cpu}" "0" "virtual CPU dependency" + + name=${model%%*([0-9]),*([0-9])} + version=${model#${name}} + name=$(lower <<<${name}) + version=${version/,/.} + pseudo "cy+model.${name}" "${version}" "virtual model dependency" + + pseudo "cy+kernel.$(lower <<<$(sysctl -n kern.ostype))" "$(sysctl -n kern.osrelease)" "virtual kernel dependency" + +} >"${status}"_ + +mv -f "${status}"{_,} + +if [[ ${cpu} == arm ]]; then + if [[ ! -h /User && -d /User ]]; then + cp -afT /User /var/mobile + fi && rm -rf /User && ln -s "/var/mobile" /User + + echo 3 >/var/lib/cydia/firmware.ver +fi