Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e5c8ca6 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan Committed by Gerrit Code Review
Browse files

build: clean up otasigcheck

- Only mount and unmount /data if it was originally unmounted
- Don't use comparison hack, just check the result of the script

Change-Id: I4a22485d315cf91e95ce578907c49f5fa3a03222
parent fa89475e
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -167,9 +167,7 @@ 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");')
        ## 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
+5 −0
Original line number Diff line number Diff line
@@ -589,9 +589,14 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
  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;")

  if "selinux_fc" in OPTIONS.info_dict:
    WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)