Ricardo Cerqueira | aff5e54 | 2014-05-09 22:24:12 +0100 | [diff] [blame] | 1 | #!/sbin/sh |
| 2 | |
| 3 | # Validate that the incoming OTA is compatible with an already-installed |
| 4 | # system |
| 5 | |
| 6 | if [ -f /data/system/packages.xml -a -f /tmp/releasekey ]; then |
Brint E. Kriebel | 8cc3992 | 2014-07-11 18:44:15 -0700 | [diff] [blame^] | 7 | relCert=$(grep -A3 'package name="com.android.htmlviewer"' /data/system/packages.xml | grep "cert index" | head -n 1 | sed -e 's|.*"\([[:digit:]][[:digit:]]*\)".*|\1|g') |
Ricardo Cerqueira | aff5e54 | 2014-05-09 22:24:12 +0100 | [diff] [blame] | 8 | |
| 9 | grep "cert index=\"$relCert\"" /data/system/packages.xml | grep -q `cat /tmp/releasekey` |
| 10 | if [ $? -ne 0 ]; then |
| 11 | echo "You have an installed system that isn't signed with this build's key, aborting..." |
| 12 | # Edify doesn't abort on non-zero executions, so let's trash the key and use sha1sum instead |
| 13 | echo "INVALID" > /tmp/releasekey |
| 14 | exit 1 |
| 15 | fi |
| 16 | fi |
| 17 | |
| 18 | exit 0 |