From 922206ec2aeea98491e3edfc297a28b0a39df698 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 4 Mar 2014 13:16:24 -0800 Subject: [PATCH] move data wipe to end of OTA package Now that OTA packages can be downloaded to /data, if they include a data wipe we should do that last. Change-Id: I75102fb2ff85d0f0110d55dfca06ec5f38104850 --- tools/releasetools/ota_from_target_files | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index 59dd06e7f..15c21282d 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -453,8 +453,6 @@ else if get_stage("%(bcb_dev)s", "stage") == "3/3" then if OPTIONS.wipe_user_data: system_progress -= 0.1 - script.ShowProgress(0.1, 10) - script.FormatPartition("/data") if "selinux_fc" in OPTIONS.info_dict: WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip) @@ -507,6 +505,10 @@ else if get_stage("%(bcb_dev)s", "stage") == "3/3" then script.UnmountAll() + if OPTIONS.wipe_user_data: + script.ShowProgress(0.1, 10) + script.FormatPartition("/data") + if OPTIONS.two_step: script.AppendExtra(""" set_stage("%(bcb_dev)s", ""); @@ -720,10 +722,6 @@ else device_specific.IncrementalOTA_InstallBegin() - if OPTIONS.wipe_user_data: - script.Print("Erasing user data...") - script.FormatPartition("/data") - script.Print("Patching system image...") script.Syspatch(system_device, tgt_mapfilename, tgt_sys_sha1, @@ -758,6 +756,10 @@ else if OPTIONS.extra_script is not None: script.AppendExtra(OPTIONS.extra_script) + if OPTIONS.wipe_user_data: + script.Print("Erasing user data...") + script.FormatPartition("/data") + if OPTIONS.two_step: script.AppendExtra(""" set_stage("%(bcb_dev)s", ""); @@ -994,10 +996,6 @@ else script.WriteRawImage("/boot", "boot.img") print "writing full boot image (forced by two-step mode)" - if OPTIONS.wipe_user_data: - script.Print("Erasing user data...") - script.FormatPartition("/data") - script.Print("Removing unneeded files...") script.DeleteFiles(["/"+i[0] for i in verbatim_targets] + ["/"+i for i in sorted(source_data) @@ -1138,6 +1136,10 @@ else script.ApplyPatch("/"+sf.name, "-", tf.size, tf.sha1, sf.sha1, "patch/"+sf.name+".p") script.SetPermissions("/system/build.prop", 0, 0, 0644, None, None) + if OPTIONS.wipe_user_data: + script.Print("Erasing user data...") + script.FormatPartition("/data") + if OPTIONS.two_step: script.AppendExtra(""" set_stage("%(bcb_dev)s", ""); -- 2.11.0