change incremental OTA file install order
(Cherry-pick from donut.)
Delete the old recovery-from-boot patch before patching system files,
then install the new one at the end of the process. Also fix an issue
with applypatch returning the wrong status.
Change-Id: I614fce39f307eded696ba792912b863f9fb0580b
diff --git a/tools/applypatch/applypatch.c b/tools/applypatch/applypatch.c
index e69a2fb..9b0c915 100644
--- a/tools/applypatch/applypatch.c
+++ b/tools/applypatch/applypatch.c
@@ -839,7 +839,7 @@
if (result != 0) {
if (retry == 0) {
printf("applying patch failed\n");
- return result;
+ return result != 0;
} else {
printf("applying patch failed; retrying\n");
}
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index dddaafc..920ce8f 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -751,7 +751,8 @@
# as fodder for constructing the recovery image.
recovery_sh_item = MakeRecoveryPatch(output_zip,
target_recovery, target_boot)
- script.UnpackPackageDir("recovery", "/system")
+ script.DeleteFiles(["/system/recovery-from-boot.p",
+ "/system/etc/install-recovery.sh"])
print "recovery image changed; including as patch from boot."
else:
print "recovery image unchanged; skipping."
@@ -787,6 +788,10 @@
script.Print("Unpacking new files...")
script.UnpackPackageDir("system", "/system")
+ if updating_recovery:
+ script.Print("Unpacking new recovery...")
+ script.UnpackPackageDir("recovery", "/system")
+
script.Print("Symlinks and permissions...")
# Create all the symlinks that don't already exist, or point to