From 2cd0b405fa1c172e8302f480c504410d03371545 Mon Sep 17 00:00:00 2001 From: codeworkx Date: Sat, 25 Feb 2012 13:17:37 +0100 Subject: [PATCH] releasetools: force unmount system before format Change-Id: Id7c7c9dc6cde50050256f9495288866a49baf810 --- releasetools/c1_edify_generator.py | 9 +++++++++ releasetools/c1_ota_from_target_files | 1 + 2 files changed, 10 insertions(+) diff --git a/releasetools/c1_edify_generator.py b/releasetools/c1_edify_generator.py index a2ccc30..95bdf48 100755 --- a/releasetools/c1_edify_generator.py +++ b/releasetools/c1_edify_generator.py @@ -35,3 +35,12 @@ class EdifyGenerator(edify_generator.EdifyGenerator): ('assert(package_extract_file("%(image)s", "/tmp/%(image)s"),\n' ' write_raw_image("/tmp/%(image)s", "%(partition)s"),\n' ' delete("/tmp/%(image)s"));') % args) + + def Unmount(self, mount_point): + """Unmount the partition with the given mount_point.""" + fstab = self.info.get("fstab", None) + if fstab: + p = fstab[mount_point] + self.script.append('unmount("%s");' % + (p.mount_point)) + self.mounts.add(p.mount_point) diff --git a/releasetools/c1_ota_from_target_files b/releasetools/c1_ota_from_target_files index bb6b61b..358b3b2 100755 --- a/releasetools/c1_ota_from_target_files +++ b/releasetools/c1_ota_from_target_files @@ -68,6 +68,7 @@ def WriteFullOTAPackage(input_zip, output_zip): if OPTIONS.wipe_user_data: script.FormatPartition("/data") + script.Unmount("/system") script.FormatPartition("/system") script.Mount("/system") script.UnpackPackageDir("recovery", "/system")