replicant-vendor_replicant/prebuilt/common/bin/otasigcheck.sh
Brint E. Kriebel 8cc3992a9f otasigcheck: Fix the sed statement for multi-digit indices
It appears that some versions of sed do not work with the + symbol.
Instead of checking for one or more digits, check for a digit,
followed by zero or more digits.

Change-Id: I064df6a2bac4a634a3684ac1a5289dca1f4ba29c
2014-07-11 18:44:15 -07:00

19 lines
706 B
Bash

#!/sbin/sh
# Validate that the incoming OTA is compatible with an already-installed
# system
if [ -f /data/system/packages.xml -a -f /tmp/releasekey ]; then
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')
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..."
# Edify doesn't abort on non-zero executions, so let's trash the key and use sha1sum instead
echo "INVALID" > /tmp/releasekey
exit 1
fi
fi
exit 0