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

Commit 88449d03 authored by Davide Garberi's avatar Davide Garberi Committed by Rashed Abdel-Tawab
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 f98e120e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -164,9 +164,11 @@ class EdifyGenerator(object):
           ");")
    self.script.append(self.WordWrap(cmd))

  def RunBackup(self, command, system_path):
    self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s", "%s");' % (
        command, system_path)))
  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 −27
Original line number Diff line number Diff line
@@ -820,13 +820,6 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
  # Dump fingerprints
  script.Print("Target: {}".format(target_info.fingerprint))

  is_system_as_root = target_info.get("system_root_image") == "true"
  if is_system_as_root and not common.system_as_system:
    system_mount_point = "/system_root"
  else:
    system_mount_point = "/system"

  script.AppendExtra("ifelse(is_mounted(\"{0}\"), unmount(\"{0}\"));".format(system_mount_point))
  device_specific.FullOTA_InstallBegin()

  CopyInstallTools(output_zip)
@@ -834,17 +827,13 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
  script.SetPermissionsRecursive("/tmp/install", 0, 0, 0755, 0644, None, None)
  script.SetPermissionsRecursive("/tmp/install/bin", 0, 0, 0755, 0755, None, None)

  if OPTIONS.backuptool:
    if is_system_as_root:
      script.fstab["/system"].mount_point = system_mount_point
    script.Mount("/system")
    if is_system_as_root and common.system_as_system:
      script.RunBackup("backup", "/system/system")
  if target_info.get("system_root_image") == "true":
    sysmount = "/"
  else:
      script.RunBackup("backup", "/system")
    script.Unmount(system_mount_point)
    if is_system_as_root:
      script.fstab["/system"].mount_point = "/"
    sysmount = "/system"

  if OPTIONS.backuptool:
    script.RunBackup("backup", sysmount)

  system_progress = 0.75

@@ -889,16 +878,7 @@ else if get_stage("%(bcb_dev)s") == "3/3" then

  if OPTIONS.backuptool:
    script.ShowProgress(0.02, 10)
    if is_system_as_root:
      script.fstab["/system"].mount_point = system_mount_point
    script.Mount("/system")
    if is_system_as_root and common.system_as_system:
      script.RunBackup("restore", "/system/system")
    else:
      script.RunBackup("restore", "/system")
    script.Unmount(system_mount_point)
    if is_system_as_root:
      script.fstab["/system"].mount_point = "/"
    script.RunBackup("restore", sysmount)

  script.ShowProgress(0.05, 5)
  script.WriteRawImage("/boot", "boot.img")