]> git.saurik.com Git - cydia.git/commitdiff
Gracefully handle someone /deleting/ the firmware package.
authorJay Freeman (saurik) <saurik@saurk.com>
Sun, 21 Dec 2008 07:34:47 +0000 (07:34 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:09:21 +0000 (07:09 +0000)
Library/firmware.sh

index 3edf8d084948ec4e373f31e11b3dca98f917fe77..0ad61754e2316b57f8185605c8e6739d747a417d 100755 (executable)
@@ -1,27 +1,21 @@
 #!/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
-            unset firmware
-        elif [[ ${line} == Architecture:* && "${firmware+@}" ]]; then
-            echo "Architecture: ${architecture}"
-            continue
-        elif [[ ${line} == Version:* && "${firmware+@}" ]]; then
-            echo "Version: ${version}"
-            continue
-        fi
-
-        echo "${line}"
-    done >/var/lib/dpkg/status_
-else
-    cat /var/lib/dpkg/status - >/var/lib/dpkg/status_ <<EOF
+cat /var/lib/dpkg/status | while IFS= read -r line; do
+    if [[ ${line} == 'Package: firmware' ]]; then
+        firmware=
+    elif [[ ${line} == '' ]]; then
+        unset firmware
+    elif [[ "${firmware+@}" ]]; then
+        continue
+    fi
+
+    echo "${line}"
+done >/var/lib/dpkg/status_
+
+cat >>/var/lib/dpkg/status_ <<EOF
 Package: firmware
 Essential: yes
 Status: install ok installed
@@ -29,13 +23,14 @@ Priority: required
 Section: System
 Installed-Size: 0
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
-Architecture: ${architecture}
+Architecture: iphoneos-arm
 Version: ${version}
 Description: almost impressive Apple frameworks
 Name: iPhone Firmware
 
 EOF
-fi && mv -f /var/lib/dpkg/status{_,}
+
+mv -f /var/lib/dpkg/status{_,}
 
 echo "/." >/var/lib/dpkg/info/firmware.list