Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: Script for flashing ROM via sideload...
- :: Preconfiguring script.
- :: http://pastebin.com/KWmdavpC
- @echo off &setlocal
- title Beatsleigher and M4gkman's Universal Android Toolkit
- color 0a
- :: do not use batch commands for variable names!
- set "kitDir=C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip"
- :: Starting ADB server
- adb start-server
- :: Adb server started (hopefully)
- goto :Beginning
- :Beginning
- :: Telling user what script does and how.
- cls
- echo.This script will download and install the ROM you prepared for installation in the Universal Android Toolkit.
- echo. If you would like to see the used commands, please go into "Universal Utilities" -> ADB Commands in the Toolkit (If applicable).
- pause
- echo.This script uses following adb commands:
- echo. adb start-server
- echo. adb devices
- echo. adb sideload
- echo. adb kill-server
- echo.
- pause
- cls
- goto :CheckDevice
- :CheckDevice
- :: Checking device shows up and is available. Requires user input.
- cls
- echo.Can you see your device in the list below?
- pause
- echo.
- adb devices
- echo.
- echo.
- echo.If yes,
- echo. and it says "Device" type "Device" below.
- echo.
- echo.If yes,
- echo. and it says "Recovery" type "Recovery" below.
- echo.
- echo.If yes,
- echo. and it says "Sideload" type "Sideload" below.
- echo.
- echo.If not,
- echo. Please make sure your device is connected to your computer and all the necessary drivers are installed and applicable.
- echo. And type "Unknown" below.
- echo.
- echo.
- :: Awaiting user input.
- set /p State=:
- if "%State%"=="Device" goto :Droid-Sideload
- if "%State%"=="device" goto :Droid-Sideload
- if "%State%"=="Recovery" goto :Recovery-Sideload
- if "%State%"=="recovery" goto :Recovery-Sideload
- if "%State%"=="Unknown" goto :CheckDevice
- if "%State%"=="unknown" goto :CheckDevice
- if "%State%"=="Sideload" goto :SideloadROM
- if "%State%"=="sideload" goto :SideloadROM
- echo.Oops! You typed something out of context!
- echo. Please try again :S
- pause
- goto :CheckDevice
- :Droid-Sideload
- :: Asking user if device is Nexus and/or supports bootloader sideloading.
- cls
- echo.Do you have a Nexus(R) device, or a device that supports native sideloading?
- echo.
- echo.If yes,
- echo. Type Nexus
- echo.
- echo.If not,
- echo. Type Misc
- :: Awaiting user input
- set /p Nexus=:
- :: use "if /i" to ignore uppercase
- if "%Nexus%"=="Nexus" goto :Nexus
- if "%Nexus%"=="nexus" goto :Nexus
- if "%Nexus%"=="Misc" goto :Recovery
- if "%Nexus%"=="misc" goto :Recovery
- echo.You have entered something out of context!
- echo. Try again? :S
- pause
- goto :Droid-Sideload
- :Nexus
- :: Nexus device - Supports natuve sideloading
- cls
- echo.Rebooting device into sideload-mode!
- adb reboot sideload
- echo.Timing out!
- timeout /nobreak /t 15
- echo.Checking file exists!!
- if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
- echo.Flahshing ROM!!
- adb sideload %kitDir%
- echo.Has the device rebooted automatically?
- echo.
- set /p reboot=: (Y/N)
- if "%reboot%"=="Y" (
- adb wait-for-device
- goto :End
- )
- if "%reboot%"=="y" (
- adb wait-for-device
- goto :End
- )
- if "%reboot%"=="N" (
- fastboot reboot
- goto :End
- )
- if "%reboot%"=="n" (
- fastboot reboot
- goto :End
- )
- :Recovery
- :: Device has CWM sideloading capability.
- echo.Rebooting device into recovery!
- adb reboot recovery
- echo.Timing out!
- timeout /nobreak /t 15
- echo.In recovery, please select "Install ROM via Sideload"
- echo. Once you have done that;
- pause
- echo.Checking file exists!!
- if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
- echo.Flashing ROM!!
- adb sideload %kitDir%
- echo.Did your device automatically reboot?
- set /p Reboot=: (Y/N)
- if "%Reboot%"=="Y" (
- goto :End
- )
- if "%Reboot%"=="y" (
- goto :End
- )
- if "%Reboot%"=="N" (
- adb reboot
- adb wait-for-device
- goto :End
- )
- if "%Reboot%"=="n" (
- adb reboot
- adb wait-for-device
- goto :End
- )
- :MissingROM
- :: Script detected ROM File is missing!
- cls
- echo.The file: %kitDir% was not found on this computer!
- echo.Please open Beatsleigher & M4gkman's Universal Android Toolkit and select "Universal Utilities" -> "Install via Sideload" and follow the steps, there.
- echo. This script will now terminate to prevent unwanted errors.
- pause
- Goto :eof
- :Exit
- :: killing ADB, exiting script.
- adb kill-server
- exit
- :Recovery-Sideload
- :: User noted device is in recovery mode. Advising him/her to select Install via Sideload.
- cls
- echo.As you're in recovery, please select "Install via Sideload"
- echo. If this option is not applicable to your device, please exit this script.
- echo.
- echo.Once you have done that;
- pause
- echo.Detecting file!
- if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
- echo.Flashing ROM!!
- adb sideload %kitDir%
- echo.
- echo.Did your device reboot automatically?
- set /p Reboot=: (Y/N)
- if "%Reboot%"=="Y" (
- goto :End
- )
- if "%Reboot%"=="y" (
- goto :End
- )
- if "%Reboot%"=="N" (
- adb reboot
- adb wait-for-device
- goto :End
- )
- if "%Reboot%"=="n" (
- adb reboot
- adb wait-for-device
- goto :End
- )
- :End
- :: Ending script.
- cls
- echo.Congratulations! You have flashed a ROM via sideload!
- echo. Thanks for using this rather awesome script!
- pause
- goto :eof
- :SideloadROM
- :: Device is already in sideload mode.
- cls
- echo.Checking ROM file exists!
- pause
- if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
- pause
- echo.Flashing ROM!
- adb sideload %kitDir%
- pause
- echo.
- echo.Did your device reboot automatically?
- echo.
- set /p reboot=: (Y/N)
- if "%reboot%"=="Y" (
- goto :End
- )
- if "%reboot%"=="y"(
- goto :End
- )
- if "%reboot%"=="N" (
- adb reboot
- fastboot reboot
- goto :End
- )
- if "%reboot%"=="n" (
- adb reboot
- fastboot reboot
- goto :End
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement