Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Stock checker zip (prepare for OTA) - Now with more Lollipop!

OP crazycaveman

3rd November 2014, 10:25 PM   |  #1  
OP Member
Thanks Meter: 87
 
60 posts
Join Date:Joined: Aug 2010
More
Here are some flashable zips I've created to check your system partition and optionally replace any files with their stock counterparts. This is particularly useful for preparing your phone for an OTA (when you get those annoying error messages that say "{APP} has unexpected contents"). You'll need to flash the zip for your specific version of Android. You can flash this as many times as you want and can flash the OTA directly after flashing this.

You need a custom recovery to flash these! For the Lollipop OTA, after flashing the correct check/fix zip, you will need to flash the stock recovery in order to install the OTA!

KTU84P to LRX21O
Just check your system files
Code:
File: system_check_hammerhead_lrx21o-from-ktu84p.zip
Google Drive
MEGA
MD5: 10e436b5d4042145b3789ee9b9fcecb5
Size: 267 kb
Check and fix your system files:
Code:
File: system_fixer_hammerhead_lrx21o-from-ktu84p.zip
Google Drive
MEGA
MD5: 2ae0f21d76429538f4ae854da67f5857
Size: 153 mb
KTU84M to KTU84P
Just check your system files:
Code:
File: system_check_hammerhead_ktu84m.zip
Google Drive
MEGA
MD5: 79b54a842debb992d0ef03eb2d7bc661
Size: 192 kb
Check and fix your system files:
Code:
File: system_fixer_hammerhead_ktu84m.zip
Google Drive
MEGA
MD5: a80331b5406042e2212fa0fe3bfeaa30
Size: 244 mb
KOT49H to KTU84M
Code:
File: check_hammerhead_kot49h_system.zip 
Google Drive 
MEGA
MD5: 3a810e0d67e2f7b17af947a9c46664ec
Size: 402 MB
If you want to check the updater-script that is in the zip file without downloading the whole thing, I've made a paste for easy access.
Standard disclaimer: I am not to be held responsible if this messes up your phone in any way. Make sure you have backed up your phone and have backups of your backups. I created it for myself and figured I'd share what I created to benefit others. Just because it works for me does not mean it will work for you. If an alien pops out of your phone or it suddenly implodes or you lose everything on it and have no backups is not my problem.

For those of you who are interested in how I generated this, you'll find the script I created to generate the file below.
System checker script (not for the faint of heart!):

If you want to run this to create the zip file yourself, you'll need a zip file of the system directory for the version you're upgrading from and the OTA zip. I'm sure there's a better way to do all this, but this is what my convoluted mind gave me...

Call the script as (2nd argument is optional) ${0} OTA.zip [system_files.zip]
Code:
#!/bin/bash
# This requires 1 argument: the update zip filename
# Also accepts 1 optional argument: system files zip filesname

update_zip=$1
if [ -z ${update_zip} ]; then
        echo "Need to let me know the name of the ota zip file!"
        exit 1
fi
extract_dir=/tmp/update_zip_check
update_dir="META-INF/com/google/android"
eval $(echo ${update_zip} | sed 's!\([^\.]*\)\.signed-\([^-]*\)-\([^-]*\)-from-\([^\.]*\).*!update_hash=\1\nhw_name=\2\nnew_ver=$(echo \3 | tr [A-Z] [a-z])\ncurr_ver=$(echo \4 | tr [A-Z] [a-z])!')
system_zip=${2:-$(ls system*${hw_name}*${curr_ver}.zip)}
fixer_zip="system_fixer_${hw_name}_${new_ver}-from-${curr_ver}.zip"
check_zip="system_check_${hw_name}_${new_ver}-from-${curr_ver}.zip"

echo -e "\n\n${update_hash}\n${hw_name}\n${new_ver}\n${curr_ver}\n${system_zip}\n${check_zip}"
sha1sum -c <<EOF
${update_hash}  ${update_zip}
EOF
if [ $? != 0 ]; then
        echo "${update_zip} doesn't match hash; please re-download"
        exit 255
fi
[ -d "${extract_dir}" ] && rm -rf "${extract_dir}"
mkdir "${extract_dir}"

echo "Updating updater-script for checking and replacing files."
unzip -q -d "${extract_dir}" "${update_zip}" "${update_dir}/update-binary" "${update_dir}/updater-script"

# The following was the old way of updating files
#unzip -q "${system_zip}" $(grep -e 'mount' -e 'getprop' -e 'assert(apply_patch_check(' -e 'assert(apply_patch_space(' ${extract_dir}/${update_dir}/updater-script | sed 's|^assert(\(apply_patch_check("/\)\([^"]*\)\(.*")\));|ifelse(\1\2\3, "", (package_extract_file("\2", "/\2"); ui_print("\/\2")));|' | tee -i ${extract_dir}/${update_dir}/updater-script_check | grep -e 'ifelse' | sed 's|^ifelse(apply_patch_check("/system/\([^"]*\)".*|\1|') -d ${extract_dir}

unzip -q -d "${extract_dir}" "${system_zip}" $(grep -e 'mount' -e 'getprop' -e '^apply_patch_check(' -e '^apply_patch_space(' ${extract_dir}/${update_dir}/updater-script | sed 's!^\(apply_patch_.*\) || abort("\\"/system/\(.*\)\\" .*);$!\1 || (ui_print("Need to fix /system/\2"); package_extract_file("\2", "/system/\2"));!' | sed 's!^\(apply_patch_check.*\) || abort("\\"\(EMMC:/dev/block/platform/.*/by-name/boot\).*);$!\1 || (ui_print("Flash boot partition"); package_extract_file("boot.img", "\2"));!' | sed 's!abort!ui_print!' | tee -i ${extract_dir}/${update_dir}/updater-script_fixer | grep -e '^apply_patch_check("/' | sed 's!^apply_patch_check("/system/\([^"]*\)".*!\1!')
sed 's!; package_extract_file([^)]*)!!' ${extract_dir}/${update_dir}/updater-script_fixer >${extract_dir}/${update_dir}/updater-script_check

mv "${extract_dir}/${update_dir}/updater-script_fixer" "${extract_dir}/${update_dir}/updater-script"
cur_dir="$(/bin/pwd)"
cd "${extract_dir}"
echo "Now creating the zip file for flashing."
zip -qr "${cur_dir}/${fixer_zip}" *

mv "${extract_dir}/${update_dir}/updater-script_check" "${extract_dir}/${update_dir}/updater-script"
zip -qr "${cur_dir}/${check_zip}" META-INF

cd "${cur_dir}"
rm -rf "${extract_dir}"
echo 'Done! Please remember to backup any APKs you have replaced on the /system partition of your device; this file will replace with the stock version for your build.'
Last edited by crazycaveman; 18th November 2014 at 06:02 PM. Reason: Update for OTA
The Following 27 Users Say Thank You to crazycaveman For This Useful Post: [ View ]
3rd November 2014, 10:30 PM   |  #2  
Paradoxxx's Avatar
Recognized Contributor
Flag Nimes
Thanks Meter: 5,478
 
4,769 posts
Join Date:Joined: Aug 2008
Donate to Me
Clever and people will find this usefull.

Thanks
4th November 2014, 09:42 AM   |  #3  
pedja1's Avatar
Recognized Developer
Flag Zrenjanin
Thanks Meter: 1,685
 
1,290 posts
Join Date:Joined: Oct 2011
Donate to Me
More
Very Nice, Thanks
You could also include checks for other partitions (boot, recovery...)
4th November 2014, 10:51 AM   |  #4  
Natherul's Avatar
Member
Flag Visby
Thanks Meter: 7
 
60 posts
Join Date:Joined: Nov 2011
More
no fix option for KTU84P? or am I blind, cheers for the zips though
4th November 2014, 02:51 PM   |  #5  
OP Member
Thanks Meter: 87
 
60 posts
Join Date:Joined: Aug 2010
More
Quote:
Originally Posted by pedja1

Very Nice, Thanks
You could also include checks for other partitions (boot, recovery...)

In the OTA checks and fixes, the zip checks everything the OTA does, which usually includes free space, modem, and kernel. The zip will alert you to these and, in the case of boot/kernel, it will install the stock kernel. You're on your own for the modem, though.

Quote:
Originally Posted by Natherul

no fix option for KTU84P? or am I blind, cheers for the zips though

Right now, that file would be HUGE since it would include every file in the system partition. I was planning on waiting for the OTA to drop to make one, but... Give me half an hour and I'll cook something up for you

Edit: I have added a new file that checks and fixes all KTU84P system files.
Last edited by crazycaveman; 4th November 2014 at 04:27 PM.
The Following 2 Users Say Thank You to crazycaveman For This Useful Post: [ View ]
13th November 2014, 07:53 PM   |  #6  
OP Member
Thanks Meter: 87
 
60 posts
Join Date:Joined: Aug 2010
More
I have uploaded the new zips for the released OTA! Get them now!

KTU84P to LRX21O
Just check your system files
Code:
File: system_check_hammerhead_lrx21o-from-ktu84p.zip
Google Drive
MEGA
MD5: 10e436b5d4042145b3789ee9b9fcecb5
Size: 267 kb
Check and fix your system files:
Code:
File: system_fixer_hammerhead_lrx21o-from-ktu84p.zip
Google Drive
MEGA
MD5: 2ae0f21d76429538f4ae854da67f5857
Size: 153 mb
Last edited by crazycaveman; 13th November 2014 at 08:03 PM.
The Following User Says Thank You to crazycaveman For This Useful Post: [ View ]
13th November 2014, 08:19 PM   |  #7  
Junior Member
Flag Bergen County, NJ
Thanks Meter: 2
 
13 posts
Join Date:Joined: Feb 2009
More
I'm slightly confused by the red labels. I have version KTU84P and want to return it to stock so I can update using the OTA (when it's available). Which file should I download to ensure my files are stock again? (I would assume the files named KTU84P to Lxxxx would be the ones?)

Also, will this remove root at all so I would be able to simply download and install the OTA?
13th November 2014, 08:37 PM   |  #8  
OP Member
Thanks Meter: 87
 
60 posts
Join Date:Joined: Aug 2010
More
Quote:
Originally Posted by danaconda1

I'm slightly confused by the red labels. I have version KTU84P and want to return it to stock so I can update using the OTA (when it's available). Which file should I download to ensure my files are stock again? (I would assume the files named KTU84P to Lxxxx would be the ones?)

Also, will this remove root at all so I would be able to simply download and install the OTA?

Yes, use the KTU84P to LRX21O to check/fix your KTU84P version. This will not remove root, it just checks the APKs and files that the OTA checks to make sure they're at the right version for patching.
13th November 2014, 11:55 PM   |  #9  
ikavior's Avatar
Junior Member
Thanks Meter: 0
 
7 posts
Join Date:Joined: Jan 2014
Quote:
Originally Posted by crazycaveman

Yes, use the KTU84P to LRX21O to check/fix your KTU84P version. This will not remove root, it just checks the APKs and files that the OTA checks to make sure they're at the right version for patching.


Hi how to run that script on Windows?

Im trying to run adb sideload system_fixer_hammerhead_lrx21o-from-ktu84p.zip and Im getting error:
Veryfing update package....
E: footer is wrong
E: signature veryfication failed
Instalation aborted.

Any ideas?
Thanks,
K.
14th November 2014, 09:19 AM   |  #10  
ikavior's Avatar
Junior Member
Thanks Meter: 0
 
7 posts
Join Date:Joined: Jan 2014
Please help me how to apply fix script.

Thanks,
K.

Post Reply Subscribe to Thread

Tags
status 7
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes