function prompt { echo $1 read -p "Ready? " -n 1 -r echo # (optional) move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then echo else echo "Quitting" exit fi } FOLDER=$1 echo "FOLDER = $FOLDER" prompt "Boot into bootloader mode" ./adb reboot bootloader sleep 10 ./fastboot devices prompt "Going to flash recovery image, system image and boot image" ./fastboot flash recovery $FOLDER/recovery.img ./fastboot flash system $FOLDER/system.img ./fastboot flash boot $FOLDER/boot.img prompt "When the last flash is confirmed, use the volume rockers to choose 'Recovery mode' and confirm with the power button. When you see the little Android lying with the red triangle warning sign on it, hold the power then press the volume up button to get to the recovery options. When you got to the recovery options, select 'apply update from ADB' using the volume rockers again and press the power button to choose it." ./adb sideload $FOLDER/update.zip prompt "When OTA update successfully installed, select 'reboot bootloader' from the recovery options again using the volume rockers and press the power button." ./fastboot flash recovery $FOLDER/twrp-2.8.7.1-hammerhead.img prompt "When the flash is confirmed, use the volume rockers to choose 'Recovery mode' and confirm with the power button. Now in the TWRP recovery menu, choose 'Advanced' > 'adb sideload'. Check both option, clear 'Dalvik-Cache' and 'Clear Cache' and swipe the bar to start sideload mode. Wait for device to say it's awaiting commands..." ./adb sideload $FOLDER/UPDATE-SuperSU-v2.40.zip echo "Finished!"