Shell script to reboot into recovery and install zip Okay, without getting too deep into details, I'm looking to automate the installation of a flashable zip (must be flashed from recovery).  For now, I can use the command "reboot recovery" in a shell script to bring me into TWRP, but I'm not sure how to tell TWRP to install something automatically.

I know this is possible because Cyanogenmod does this exact thing with their ROM update utility.  Once a ROM update is downloaded, you click "Reboot and Install" from within CM, the phone reboots into TWRP, the installation of the flashable zip begins, and after it completes the phone reboots again back into CM.

I don't know if I can just append the file's path onto the "reboot" command with a particular switch?  I haven't been able to find documentation on the available options.  I was also thinking maybe TWRP looks for an update.zip file upon launching?

Does anyone know how to do this?
I ended up looking at Cyanongenmod's source code and figured out how they did it.

Here is my working .sh script:

echo 'boot-recovery ' &gt; /cache/recovery/command
echo '--update_package=/sdcard/update.zip' &gt;&gt; /cache/recovery/command
reboot recovery


Update:

with android JellyBean [4.1] and later versions, the sdcard data is located now at /sdcard/0, So the second command must be:

echo '--update_package=/sdcard/0/update.zip' &gt;&gt; /cache/recovery/command