Guest User

Untitled

a guest
Feb 19th, 2013
40
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :: Script for flashing ROM via sideload...
  2. :: Preconfiguring script.
  3. :: http://pastebin.com/KWmdavpC
  4. @echo off &setlocal
  5. title Beatsleigher and M4gkman's Universal Android Toolkit
  6. color 0a
  7. :: do not use batch commands for variable names!
  8. set "kitDir=C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip"
  9. :: Starting ADB server
  10. adb start-server
  11. :: Adb server started (hopefully)
  12. goto :Beginning
  13.  
  14. :Beginning
  15. :: Telling user what script does and how.
  16. cls
  17. echo.This script will download and install the ROM you prepared for installation in the Universal Android Toolkit.
  18. echo.   If you would like to see the used commands, please go into "Universal Utilities" -> ADB Commands in the Toolkit (If applicable).
  19. pause
  20. echo.This script uses following adb commands:
  21. echo.   adb start-server
  22. echo.   adb devices
  23. echo.   adb sideload
  24. echo.   adb kill-server
  25. echo.
  26. pause
  27. cls
  28. goto :CheckDevice
  29.  
  30. :CheckDevice
  31. :: Checking device shows up and is available. Requires user input.
  32. cls
  33. echo.Can you see your device in the list below?
  34. pause
  35. echo.
  36. adb devices
  37. echo.
  38. echo.
  39. echo.If yes,
  40. echo.   and it says "Device" type "Device" below.
  41. echo.
  42. echo.If yes,
  43. echo.   and it says "Recovery" type "Recovery" below.
  44. echo.
  45. echo.If yes,
  46. echo.   and it says "Sideload" type "Sideload" below.
  47. echo.
  48. echo.If not,
  49. echo.   Please make sure your device is connected to your computer and all the necessary drivers are installed and applicable.
  50. echo.       And type "Unknown" below.
  51. echo.
  52. echo.
  53. :: Awaiting user input.
  54. set /p State=:
  55. if "%State%"=="Device" goto :Droid-Sideload
  56. if "%State%"=="device" goto :Droid-Sideload
  57. if "%State%"=="Recovery" goto :Recovery-Sideload
  58. if "%State%"=="recovery" goto :Recovery-Sideload
  59. if "%State%"=="Unknown" goto :CheckDevice
  60. if "%State%"=="unknown" goto :CheckDevice
  61. if "%State%"=="Sideload" goto :SideloadROM
  62. if "%State%"=="sideload" goto :SideloadROM
  63. echo.Oops! You typed something out of context!
  64. echo.   Please try again :S
  65. pause
  66. goto :CheckDevice
  67.  
  68. :Droid-Sideload
  69. :: Asking user if device is Nexus and/or supports bootloader sideloading.
  70. cls
  71. echo.Do you have a Nexus(R) device, or a device that supports native sideloading?
  72. echo.
  73. echo.If yes,
  74. echo.   Type Nexus
  75. echo.
  76. echo.If not,
  77. echo.   Type Misc
  78. :: Awaiting user input
  79. set /p Nexus=:
  80. :: use "if /i" to ignore uppercase
  81. if "%Nexus%"=="Nexus" goto :Nexus
  82. if "%Nexus%"=="nexus" goto :Nexus
  83. if "%Nexus%"=="Misc" goto :Recovery
  84. if "%Nexus%"=="misc" goto :Recovery
  85. echo.You have entered something out of context!
  86. echo.   Try again? :S
  87. pause
  88. goto :Droid-Sideload
  89.  
  90. :Nexus
  91. :: Nexus device - Supports natuve sideloading
  92. cls
  93. echo.Rebooting device into sideload-mode!
  94. adb reboot sideload
  95. echo.Timing out!
  96. timeout /nobreak /t 15
  97. echo.Checking file exists!!
  98. if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
  99. echo.Flahshing ROM!!
  100. adb sideload %kitDir%
  101. echo.Has the device rebooted automatically?
  102. echo.
  103. set /p reboot=: (Y/N)
  104. if "%reboot%"=="Y" (
  105. adb wait-for-device
  106. goto :End
  107. )
  108. if "%reboot%"=="y" (
  109. adb wait-for-device
  110. goto :End
  111. )
  112. if "%reboot%"=="N" (
  113. fastboot reboot
  114. goto :End
  115. )
  116. if "%reboot%"=="n" (
  117. fastboot reboot
  118. goto :End
  119. )
  120.  
  121. :Recovery
  122. :: Device has CWM sideloading capability.
  123. echo.Rebooting device into recovery!
  124. adb reboot recovery
  125. echo.Timing out!
  126. timeout /nobreak /t 15
  127. echo.In recovery, please select "Install ROM via Sideload"
  128. echo.   Once you have done that;
  129. pause
  130. echo.Checking file exists!!
  131. if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
  132. echo.Flashing ROM!!
  133. adb sideload %kitDir%
  134. echo.Did your device automatically reboot?
  135. set /p Reboot=: (Y/N)
  136. if "%Reboot%"=="Y" (
  137. goto :End
  138. )
  139. if "%Reboot%"=="y" (
  140. goto :End
  141. )
  142. if "%Reboot%"=="N" (
  143. adb reboot
  144. adb wait-for-device
  145. goto :End
  146. )
  147. if "%Reboot%"=="n" (
  148. adb reboot
  149. adb wait-for-device
  150. goto :End
  151. )
  152.  
  153. :MissingROM
  154. :: Script detected ROM File is missing!
  155. cls
  156. echo.The file: %kitDir% was not found on this computer!
  157. echo.Please open Beatsleigher & M4gkman's Universal Android Toolkit and select "Universal Utilities" -> "Install via Sideload" and follow the steps, there.
  158. echo.       This script will now terminate to prevent unwanted errors.
  159. pause
  160. Goto :eof
  161.  
  162. :Exit
  163. :: killing ADB, exiting script.
  164. adb kill-server
  165. exit
  166.  
  167. :Recovery-Sideload
  168. :: User noted device is in recovery mode. Advising him/her to select Install via Sideload.
  169. cls
  170. echo.As you're in recovery, please select "Install via Sideload"
  171. echo.   If this option is not applicable to your device, please exit this script.
  172. echo.
  173. echo.Once you have done that;
  174. pause
  175. echo.Detecting file!
  176. if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
  177. echo.Flashing ROM!!
  178. adb sideload %kitDir%
  179. echo.
  180. echo.Did your device reboot automatically?
  181. set /p Reboot=: (Y/N)
  182. if "%Reboot%"=="Y" (
  183. goto :End
  184. )
  185. if "%Reboot%"=="y" (
  186. goto :End
  187. )
  188. if "%Reboot%"=="N" (
  189. adb reboot
  190. adb wait-for-device
  191. goto :End
  192. )
  193. if "%Reboot%"=="n" (
  194. adb reboot
  195. adb wait-for-device
  196. goto :End
  197. )
  198.  
  199. :End
  200. :: Ending script.
  201. cls
  202. echo.Congratulations! You have flashed a ROM via sideload!
  203. echo.   Thanks for using this rather awesome script!
  204. pause
  205. goto :eof
  206.  
  207. :SideloadROM
  208. :: Device is already in sideload mode.
  209. cls
  210.  
  211. echo.Checking ROM file exists!
  212. pause
  213. if not exist "C:\Universal_Android_Kit\Downloads\RomViaSideload\RomForSideLoad.zip" goto :MissingROM
  214. pause
  215. echo.Flashing ROM!
  216. adb sideload %kitDir%
  217. pause
  218. echo.
  219. echo.Did your device reboot automatically?
  220. echo.
  221. set /p reboot=: (Y/N)
  222. if "%reboot%"=="Y" (
  223. goto :End
  224. )
  225. if "%reboot%"=="y"(
  226. goto :End
  227. )
  228. if "%reboot%"=="N" (
  229. adb reboot
  230. fastboot reboot
  231. goto :End
  232. )
  233. if "%reboot%"=="n" (
  234. adb reboot
  235. fastboot reboot
  236. goto :End
  237. )
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×