Taken from AOKP's latest 

https://github.com/AOKP/build/blob/jb-mr1/tools/releasetools/ota_from_target_files