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");')
- ## Hax: a failure from run_program doesn't trigger an abort, so have it change the key value and 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");')
+ 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");')
def ShowProgress(self, frac, dur):
"""Update the progress bar, advancing it over 'frac' over the next
if block_based:
common.ZipWriteStr(output_zip, "system/bin/otasigcheck.sh",
""+input_zip.read("SYSTEM/bin/otasigcheck.sh"))
+
+ script.AppendExtra("if is_mounted(\"/data\") then")
+ script.ValidateSignatures("data")
+ script.AppendExtra("else")
script.Mount("/data")
script.ValidateSignatures("data")
script.Unmount("/data")
+ script.AppendExtra("endif;")
# Place a copy of file_contexts.bin into the OTA package which will be used
# by the recovery program.