::visit Rootjunky.com

::Set our Window Title
@title Amazon Fire Tablet Tool

::Set our default parameters
@echo off
color 0b



:menuLOOP

	call:header
	::Print our header
	::call:header
	
	::Load up our menu selections
	echo.--------------------------------------------------------------------------------
	for /f "tokens=1,2,* delims=_ " %%A in ('"C:/Windows/system32/findstr.exe /b /c:":menu_" "%~f0""') do echo.  %%B  %%C
	
	call:printstatus

	set choice=
	echo.&set /p choice= Please make a selection or hit ENTER to exit: ||GOTO:EOF
	echo.&call:menu_%choice%
	
GOTO:menuLOOP

:menu_1    ADB driver test                 
cls
color 0b
files\adb.exe kill-server
files\adb.exe start-server
echo.--------------------------------------------------------------------------------
echo [*] This option will run a program to get your adb drivers
echo [*] installed for your Amazon Fire Tablet exit program when done
echo.--------------------------------------------------------------------------------
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"C:/Windows/system32/findstr.exe /b /c:":driver_" "%~f0""') do echo.  %%B  %%C
	set choice=
	echo.&set /p choice= Please make a selection then hit ENTER:
	echo.&call:driver_%choice%
color 0b	
cls
GOTO:EOF

:driver_1 ADB driver install
cls
color 0b
echo.--------------------------------------------------------------------------------
echo [*] Before continuing, ensure USB debugging is enabled
echo [*] in your Amazon fire 5th gen settings 
echo [*] go to device options then click on serial number 7 times to enable 
echo [*] developer options then in developer options turn on Enable adb option.
echo [*] MAKES SURE YOUR ANTI VERUS IS OFF. 
echo.--------------------------------------------------------------------------------
echo [*] press any key to start adb driver install
pause >nul
echo.--------------------------------------------------------------------------------
start devmgmt.msc
echo [*] Device Manager should open up wait for it. 
echo [*] Find Amazon Fire and right click on it. 
echo [*] Select Properties then Update Driver 
echo [*] "Browse My Computer For Driver Software" 
echo [*] "Let Me Pick from a List of Device Drivers on my Computer
echo [*] choose Have Disk
echo [*] Browse to the usb_drivers fold that is in this tool
echo [*] then click Next NOTE drivers are not signed this is fine. 
echo [*] once installed ADB should find the Amazon Fire Tablet.
echo [*] NOTE you may have to use these same steps to install the fastboot drivers
echo.--------------------------------------------------------------------------------
echo [*] please run the driver test to make sure drivers work before installing apps
echo.--------------------------------------------------------------------------------
pause
cls
echo [*] If your drivers still do not install then please try running the 
echo [*] kindledriver.exe in the usb_driver folder. good luck
echo.--------------------------------------------------------------------------------
echo [*] RootJunky OUT
files\adb.exe kill-server
pause
	set choice=
	echo.&set /p choice= hit ENTER to return to start: ||GOTO:EOF
	echo.&call:bootsubmenu_%choice%
color 0b	
cls	
GOTO:EOF


:driver_2  ADB Driver Test
cls
color 0b
echo [*] Press any key to check if your drivers are installed
echo [*] correctly. 
echo.--------------------------------------------------------------------------------
pause > nul
echo.--------------------------------------------------------------------------------
echo [*] Is there a device listed under list of devices attached?
echo [*] IF no then reboot computer and run the driver install option 
echo [*] again then recheck
echo [*] press any key to continue
echo.--------------------------------------------------------------------------------
files\adb.exe devices
pause > nul
echo.--------------------------------------------------------------------------------
echo [*] Test Complete
echo.--------------------------------------------------------------------------------
pause > nul
echo [*] RootJunky OUT
files\adb.exe kill-server
	set choice=
	echo.&set /p choice= hit ENTER to return to start: ||GOTO:EOF
	echo.&call:bootsubmenu_%choice%
color 0b	
cls	
GOTO:EOF


:menu_2 Install Google Play store
cls
color 0b
files\adb.exe kill-server
files\adb.exe start-server
echo.--------------------------------------------------------------------------------
echo First you must turn on ADB DEBUGGING in your Amazon fire 5th gen settings 
echo go to device options then click on serial number 7 times to enable 
echo developer options then in developer options turn on Enable adb option.
echo also make sure your drivers are installed 
echo.--------------------------------------------------------------------------------
pause
cls
files\adb.exe wait-for-device
echo [*] Installing Google Play Store apps this will take some time
echo.--------------------------------------------------------------------------------
echo [*] Installing app 1 of 5
files\adb.exe install -r apps\com.google.android.gms-6.6.03-6603036-minAPI9.apk
echo.--------------------------------------------------------------------------------
echo [*] Installing app 2 of 5
files\adb.exe install -r apps\GoogleLoginService.apk
echo.--------------------------------------------------------------------------------
echo [*] Installing app 3 of 5
files\adb.exe install -r apps\com.google.android.googlequicksearchbox.apk
echo.--------------------------------------------------------------------------------
echo [*] Installing app 4 of 5
files\adb.exe install -r apps\GoogleServicesFramework.apk
files\adb.exe shell pm grant com.google.android.gms android.permission.INTERACT_ACROSS_USERS
echo.--------------------------------------------------------------------------------
echo [*] Installing app 5 of 5
files\adb.exe install -r apps\com.android.vending-5.9.12-80391200-minAPI9.apk
echo.--------------------------------------------------------------------------------
echo [*] all apps installed and permissions set.
echo [*] please reboot device to finish the process then sign into Play store
echo.--------------------------------------------------------------------------------
files\adb.exe kill-server
pause
color 0b	
cls
GOTO:EOF


:menu_3 Switch to Nova Launcher  
cls
color 0b
files\adb.exe kill-server
files\adb.exe start-server
echo.-------------------------------------------------------------------------------- 
echo [*] Make sure USB Debugging is enabled on your tablet
echo [*] this will install Nova Launcher to override Amazon launcher
echo.--------------------------------------------------------------------------------
echo [*] press any key to start
pause > nul
echo [*] waiting for device
files\adb.exe wait-for-device
echo.--------------------------------------------------------------------------------
echo [*] Installing Nova Launcher
echo.--------------------------------------------------------------------------------
files\adb.exe install -r apps\NovaLauncher_5.5.4.apk
echo.--------------------------------------------------------------------------------
echo [*] Installing Launcher HiJack
echo.--------------------------------------------------------------------------------
files\adb.exe install -r apps\LauncherHijackV3.apk
echo.--------------------------------------------------------------------------------
echo [*] Open settings app and select accessiblitities and enable 
echo [*] both Nova and Hijack apps. 
echo [*] Nova Launcher is installed on device now.
echo.--------------------------------------------------------------------------------
echo [*] Press any key to finish this script. ROOTJUNKY OUT
files\adb.exe kill-server
pause > nul
	set choice=
	echo.&set /p choice= hit ENTER to return to start: ||GOTO:EOF
	echo.&call:bootsubmenu_%choice%
cls	
GOTO:EOF


:header  
cls        
color 0e
echo   """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
echo   "    ___  ____  ____  _____    ____  ___  ____ ____  __  ________  _  _    "
echo   "   / _ \/ _  \/ _  \/_  _/_  / / / / / \/ / //_/\ \/ / / __/ _  \/ \/ \   "
echo   "  / , _/ |_| / |_| / / / / // / /_/ /    /  <    \  /_/ /_/ |_| / ,  , \  "
echo   " /_/|_|\____/\____/ /_/  \___/\____/_/\_/_/\_/   /_/_/___/\____/_/ \/ \_\ "
echo   "                                                                          "
echo   """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
echo.                                 RootJunky
echo.--------------------------------------------------------------------------------
echo.
files\adb.exe kill-server
files\adb.exe start-server
echo.--------------------------------------------------------------------------------
files\adb.exe devices
timeout 5 > nul
files\fastboot.exe devices
timeout 3 > nul
files\adb.exe kill-server
cls	
color 0b
GOTO:EOF

:printstatus
echo.
echo. Lets Do This...
echo.--------------------------------------------------------------------------------
GOTO:EOF

