]> git.saurik.com Git - cydia.git/blobdiff - Library/firmware.sh
Ignore .dSYM folders I am suddenly ending up with.
[cydia.git] / Library / firmware.sh
index 572eab17645da3920b38339076e3214f38a7f2c6..f7479ba8fcf4f7273d96bf227d4f24e12bffb26f 100755 (executable)
@@ -8,7 +8,7 @@ shopt -s nullglob
 version=$(sw_vers -productVersion)
 cpu=$(uname -p)
 
-if [[ ${cpu} == arm ]]; then
+if [[ ${cpu} == arm || ${cpu} == arm64 ]]; then
     data=/var/lib/dpkg
     model=hw.machine
     arch=iphoneos-arm
@@ -23,7 +23,7 @@ model=$(sysctl -n "${model}")
 status=${data}/status
 
 function lower() {
-    tr '[:upper:]' '[:lower:]'
+    sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'
 }
 
 # Generate New Package {{{
@@ -41,6 +41,7 @@ Installed-Size: 0
 Architecture: ${arch}
 Version: ${version}
 Description: ${description}
+Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Tag: role::cydia
 EOF
 
@@ -49,10 +50,16 @@ EOF
 }
 # }}}
 
+output=$(mktemp "${data}"/status-tmp.XXXXXX)
+chmod 644 "${output}"
+xxxxxx=${output##*/status-tmp.}
+rm -f "${data}"/status-tmp.!("${xxxxxx}")
+
 {
 
 # Delete Old Packages {{{
-    firmware=
+    unset firmware
+    unset blank
 
     while IFS= read -r line; do
         #echo "#${firmware+@}/${blank+@} ${line}" 1>&2
@@ -86,21 +93,36 @@ EOF
     fi
 # }}}
 
-    if [[ ${cpu} == arm ]]; then
-        pseudo "firmware" "${version}" "almost impressive Apple frameworks"
+    if [[ ${cpu} == arm || ${cpu} == arm64 ]]; then
+        pseudo "firmware" "${version}" "almost impressive Apple frameworks" "iOS Firmware"
+
+        while [[ 1 ]]; do
+            gssc=$(gssc 2>&1)
+            if [[ ${gssc} != *'(null)'* ]]; then
+                break
+            fi
+            sleep 1
+        done
 
-        gssc 2>&1 | sed -re '
+        echo "${gssc}" | sed -re '
             /^    [^ ]* = [0-9.]*;$/ ! d;
             s/^    ([^ ]*) = ([0-9.]*);$/\1 \2/;
-            s/([A-Z])/-\L\1/g; s/^"([^ ]*)"/\1/;
+            s/([A-Z])/-\L\1/g;
+            s/^"([^ ]*)"/\1/;
             s/^-//;
             / 0$/ d;
-        ' | while read -r name value; do
-            pseudo "gsc.${name}" "${value}" "virtual GraphicsServices dependency"
-        done
+        ' | while read -r name value; do case "${name}" in
+            (ipad) for name in ipad wildcat; do
+                pseudo "gsc.${name}" "${value}" "this device has a very large screen" "iPad"
+            done;;
+
+            (*)
+                pseudo "gsc.${name}" "${value}" "virtual GraphicsServices dependency"
+            ;;
+        esac; done
     fi
 
-    if [[ ${cpu} == arm ]]; then
+    if [[ ${cpu} == arm || ${cpu} == arm64 ]]; then
         os=ios
     else
         os=macosx
@@ -117,14 +139,16 @@ EOF
 
     pseudo "cy+kernel.$(lower <<<$(sysctl -n kern.ostype))" "$(sysctl -n kern.osrelease)" "virtual kernel dependency"
 
-} >"${status}"_
+    pseudo "cy+lib.corefoundation" "$(/usr/libexec/cydia/cfversion)" "virtual corefoundation dependency"
+
+} >"${output}"
 
-mv -f "${status}"{_,}
+mv -f "${output}" "${status}"
 
-if [[ ${cpu} == arm ]]; then
+if [[ ${cpu} == arm || ${cpu} == arm64 ]]; 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
+    echo 6 >/var/lib/cydia/firmware.ver
 fi