patch the /system/build.prop file last

Works around a problem observed on a retail device: incremental update
from build 1 to build 2 partially completed, leaving a mix of files
from the two builds.  (Why it booted into the regular system instead
of recovery to restart update installation is still a mystery.)
build.prop was one of the files updated, so the device reported itself
as having build 2.  The device hobbled along for months in this state,
until build 3 was released and the 2-to-3 incremental package
repeatedly failed (because some of the files it was trying to patch
were build 1).

This change makes updating build.prop the very last thing does by an
incremental update script, so if installation is aborted and the
regular system starts (and works at all), it will continue reporting
itself as build 1 and be sent the 1-to-2 OTA package again.

Change-Id: I1edc1dcef2bd2495b6fd96517c2f4c574b994f27
This commit is contained in:
Doug Zongker 2011-08-26 13:46:40 -07:00
parent d7d096df71
commit e92f15a858
1 changed files with 15 additions and 1 deletions

View File

@ -613,7 +613,12 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
so_far = 0
script.Print("Patching system files...")
for fn, tf, sf, size, _ in patch_list:
deferred_patch_list = []
for item in patch_list:
fn, tf, sf, size, _ = item
if tf.name == "system/build.prop":
deferred_patch_list.append(item)
continue
script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1, sf.sha1, "patch/"+fn+".p")
so_far += tf.size
script.SetProgress(so_far / total_patch_size)
@ -715,6 +720,15 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
if OPTIONS.extra_script is not None:
script.AppendExtra(OPTIONS.extra_script)
# Patch the build.prop file last, so if something fails but the
# device can still come up, it appears to be the old build and will
# get set the OTA package again to retry.
script.Print("Patching remaining system files...")
for item in deferred_patch_list:
fn, tf, sf, size, _ = item
script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1, sf.sha1, "patch/"+fn+".p")
script.SetPermissions("/system/build.prop", 0, 0, 0644)
script.AddToZip(target_zip, output_zip)
WriteMetadata(metadata, output_zip)