summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-03-02 10:54:28 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2008-03-02 10:54:28 +0000
commit1ca3a01ad6422999a1fd172b82a3124f9b361bb0 (patch)
tree88866d2216967676c3db007726aab1947cf4ec0f
parent2a8d9add1233208d9a9205d879f4294bf0ab18fc (diff)
Added firmware management scripts.
-rw-r--r--Library/com.saurik.Cydia.Firmware12
-rwxr-xr-xLibrary/firmware.sh43
2 files changed, 55 insertions, 0 deletions
diff --git a/Library/com.saurik.Cydia.Firmware b/Library/com.saurik.Cydia.Firmware
new file mode 100644
index 0000000..6fdcf33
--- /dev/null
+++ b/Library/com.saurik.Cydia.Firmware
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>com.saurik.Cydia.Firmware</string>
+ <key>Program</key>
+ <string>/usr/libexec/cydia/firmware.sh</string>
+ <key>RunAtLoad</key>
+ <true/>
+</dict>
+</plist>
diff --git a/Library/firmware.sh b/Library/firmware.sh
new file mode 100755
index 0000000..e0ef0ab
--- /dev/null
+++ b/Library/firmware.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+version=$(sw_vers -productVersion)
+
+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
+
+ echo "${line}"
+ done >/var/lib/dpkg/status_
+else
+ cat /var/lib/dpkg/status - >/var/lib/dpkg/status_ <<EOF
+Package: firmware
+Essential: yes
+Status: install ok installed
+Priority: required
+Section: System
+Installed-Size: 0
+Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
+Architecture: darwin-arm
+Version: ${version}
+Description: almost impressive Apple frameworks
+Name: Apple iPhone Firmware
+
+EOF
+fi && mv -f /var/lib/dpkg/status{_,}
+
+if [[ ${version} = 1.0* || ${version} = 1.1.[012] ]]; then
+ user=root
+else
+ user=mobile
+fi
+
+if [[ ! -h /User && -d /User ]]; then
+ cp -afT /User /var/"${user}"
+fi && rm -rf /User && ln -s "/var/${user}" /User