2014-05-09 21:24:12 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
|
|
|
|
# Validate that the incoming OTA is compatible with an already-installed
|
|
|
|
# system
|
|
|
|
|
2014-09-24 19:46:09 +00:00
|
|
|
grep -q "Command:.*\"--wipe\_data\"" /tmp/recovery.log
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "Data will be wiped after install; skipping signature check..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-11-29 01:39:21 +00:00
|
|
|
grep -q "Command:.*\"--headless\"" /tmp/recovery.log
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "Headless mode install; skipping signature check..."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-05-09 21:24:12 +00:00
|
|
|
if [ -f /data/system/packages.xml -a -f /tmp/releasekey ]; then
|
2014-07-12 01:44:15 +00:00
|
|
|
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')
|
2014-05-09 21:24:12 +00:00
|
|
|
|
2014-12-01 15:15:15 +00:00
|
|
|
# Tools missing? Err on the side of caution and exit cleanly
|
|
|
|
if [ "z$relCert" == "z" ]; then exit 0; fi
|
|
|
|
|
2014-05-09 21:24:12 +00:00
|
|
|
grep "cert index=\"$relCert\"" /data/system/packages.xml | grep -q `cat /tmp/releasekey`
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "You have an installed system that isn't signed with this build's key, aborting..."
|
2014-12-01 15:15:15 +00:00
|
|
|
exit 124
|
2014-05-09 21:24:12 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|