From f0f601f977c0bd5a97fa6292b659d28dbdf1b0de Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Sun, 30 Nov 2014 15:09:43 +0000 Subject: otasigcheck: Go back to the key-rewrite check. Using an intermediate file had the at-the-time unintended but good side-effect of making execution failures (absent script, no busybox in recovery, bad selinux setup) pass gracefully. Since this check is intended as a blacklist, blocking the update when only sure that breakage will ensue, that was a nice thing to get. Checking the return code, while cleaner, is making non-key-related failures like those mentioned above abort execution of the script. The key itself isn't even checked, yet we're aborting because of it. So go back to the original behavior: In case we're not sure... pass. To do: This can be cleaned up differently, and to the same effect, by returning an explicit error code from the script and aborting when that error comes up. Change the script to do that and come back here. :) Change-Id: Ic9d7c3128047c25f31e2ef416c9df4d21ca0a1a8 --- tools/releasetools/edify_generator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/releasetools/edify_generator.py') diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py index 61af160..6ebf11d 100644 --- a/tools/releasetools/edify_generator.py +++ b/tools/releasetools/edify_generator.py @@ -168,7 +168,9 @@ class EdifyGenerator(object): self.script.append('package_extract_file("system/bin/otasigcheck.sh", "/tmp/otasigcheck.sh");') self.script.append('package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");') self.script.append('set_metadata("/tmp/otasigcheck.sh", "uid", 0, "gid", 0, "mode", 0755);') - self.script.append('run_program("/tmp/otasigcheck.sh") == "0" || abort("Can\'t install this package on top of incompatible data. Please try another package or run a factory reset");') + self.script.append('run_program("/tmp/otasigcheck.sh");') + ## The script changes the key value when it fails, check for "INVALID" + self.script.append('sha1_check(read_file("/tmp/releasekey"),"7241e92725436afc79389d4fc2333a2aa8c20230") && abort("Can\'t install this package on top of incompatible data. Please try another package or run a factory reset");') def ShowProgress(self, frac, dur): """Update the progress bar, advancing it over 'frac' over the next -- cgit v1.1