Fixing up your Android OTA file

If you’ve deleted some apps (e.g. using TitaniumBackup) and have a custom recovery, but you still want to apply an OTA, here’s what you can do:

  • unzip the OTA file (into a directory named “n”)
  • Run some sed commands:

cp $FILE t
sed -i '/apply_patch_check.*EmailGoogle/d;/apply_patch.*EmailGoogle/,+2d' $FILE
sed -i '/apply_patch_check.*PlusOne/d;/apply_patch.*PlusOne/,+2d' $FILE
sed -i '/apply_patch_check.*Gmail/d;/apply_patch.*Gmail/,+2d' $FILE
diff -u t $FILE
rm n/recovery/etc/
cd n
zip -r ../ .

and then use your custom recovery (e.g. clockwork) to install the zip.