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
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 59dd06e..15c2128 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -453,8 +453,6 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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", "");