From 322cc5ae59c6ab388c362d02f17d25725d42d048 Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Wed, 2 Dec 2015 13:24:54 -0800 Subject: [PATCH] otasigcheck: Rewrite for CM 13.0 Rewrite the packages.xml parser to be slightly less brittle. Read lines from packages.xml and save off the interesting values, then compare with expected results afterward. This both avoids using grep's -A option, which is not supported in toybox, and allows the script to recognize the cert tag regardless of its position inside the package tag. Change-Id: Idc0006e38f4a3f9d5aec223a8a1571f5c11fe3bb --- prebuilt/common/bin/otasigcheck.sh | 67 +++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/prebuilt/common/bin/otasigcheck.sh b/prebuilt/common/bin/otasigcheck.sh index ad7f3a3e..99fdaec2 100644 --- a/prebuilt/common/bin/otasigcheck.sh +++ b/prebuilt/common/bin/otasigcheck.sh @@ -15,14 +15,71 @@ if [ $? -eq 0 ]; then exit 0 fi -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') +if [ -f "/data/system/packages.xml" -a -f "/tmp/releasekey" ]; then + relkey=$(cat "/tmp/releasekey") + OLDIFS="$IFS" + IFS="" + while read line; do + params=${line# *