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

Commit bd80e0ca authored by Davide Garberi's avatar Davide Garberi Committed by Michael Bestas
Browse files

releasetools: Move system mount handling to backuptool

* This allows the ROM to be flashed on any recovery, whether it mounts
  system to /system, /system_root or /mnt/system like Q recovery

* Remove any type of system mount with static paths from updater-script
  to figure out the path dinamically through backuptool

Change-Id: I7b33726305cb6f3eec146d26135f0081002a25dc
parent beeaa2cf
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -156,8 +156,11 @@ class EdifyGenerator(object):
           ");")
    self.script.append(self.WordWrap(cmd))

  def RunBackup(self, command):
    self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s");' % command))
  def RunBackup(self, command, mount_point):
    if self.fstab:
      p = self.fstab[mount_point]
    self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s", "%s", "%s");' % (
        command, p.device, p.fs_type)))

  def ShowProgress(self, frac, dur):
    """Update the progress bar, advancing it over 'frac' over the next
+7 −7
Original line number Diff line number Diff line
@@ -822,7 +822,6 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
  # Dump fingerprints
  script.Print("Target: {}".format(target_info.fingerprint))

  script.AppendExtra("ifelse(is_mounted(\"/system\"), unmount(\"/system\"));")
  device_specific.FullOTA_InstallBegin()

  CopyInstallTools(output_zip)
@@ -830,10 +829,13 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
  script.SetPermissionsRecursive("/tmp/install", 0, 0, 0o755, 0o644, None, None)
  script.SetPermissionsRecursive("/tmp/install/bin", 0, 0, 0o755, 0o755, None, None)

  if target_info.get("system_root_image") == "true":
    sysmount = "/"
  else:
    sysmount = "/system"

  if OPTIONS.backuptool:
    script.Mount("/system")
    script.RunBackup("backup")
    script.Unmount("/system")
    script.RunBackup("backup", sysmount)

  # All other partitions as well as the data wipe use 10% of the progress, and
  # the update of the system partition takes the remaining progress.
@@ -869,9 +871,7 @@ else if get_stage("%(bcb_dev)s") == "3/3" then

  if OPTIONS.backuptool:
    script.ShowProgress(0.02, 10)
    script.Mount("/system")
    script.RunBackup("restore")
    script.Unmount("/system")
    script.RunBackup("restore", sysmount)

  script.WriteRawImage("/boot", "boot.img")