]> git.saurik.com Git - cydia.git/blobdiff - Library/firmware.sh
Cytore values need to be _packed (I got lucky :D).
[cydia.git] / Library / firmware.sh
index 1bc6a4141ad0e91086b042b87154b2c49241fdc1..d2f89ebdf2b7f46ee949c5d710502f0c60281580 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
@@ -49,6 +49,12 @@ EOF
 }
 # }}}
 
+before=$(stat -c '%i-%Y' status)
+
+output=$(mktemp status-tmp.XXXXXX)
+xxxxxx=${output##status-tmp.}
+rm -f status-tmp.!("${xxxxxx}")
+
 {
 
 # Delete Old Packages {{{
@@ -87,7 +93,7 @@ EOF
     fi
 # }}}
 
-    if [[ ${cpu} == arm ]]; then
+    if [[ ${cpu} == arm || ${cpu} == arm64 ]]; then
         pseudo "firmware" "${version}" "almost impressive Apple frameworks" "iOS Firmware"
 
         while [[ 1 ]]; do
@@ -101,7 +107,8 @@ EOF
         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 case "${name}" in
@@ -115,7 +122,7 @@ EOF
         esac; done
     fi
 
-    if [[ ${cpu} == arm ]]; then
+    if [[ ${cpu} == arm || ${cpu} == arm64 ]]; then
         os=ios
     else
         os=macosx
@@ -134,11 +141,13 @@ EOF
 
     pseudo "cy+lib.corefoundation" "$(/usr/libexec/cydia/cfversion)" "virtual corefoundation dependency"
 
-} >"${status}"_
+} >"${output}"
 
-mv -f "${status}"{_,}
+# XXX: this is a poor replacement for flock
+test "${before}" = "$(stat -c '%i-%Y' 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