forked from esc0rtd3w/firestick-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-tank-install-lineageos.cmd
211 lines (169 loc) · 4.14 KB
/
setup-tank-install-lineageos.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
@echo off
title Install LineageOS Full Setup Script For Tank
set debug=0
set fireOsVersion=0.0.0.0
set fireOsDevice=none
set downgrade=0
set adult=0
set adultCheck=0
set magiskZip=Magisk.zip
set adb="%~dp0bin\adb.exe"
set adbKill=%adb% kill-server
set adbStart=%adb% start-server
set adbWait=%adb% wait-for-device
set sleep="%~dp0bin\wait.exe"
set extractRAR="%~dp0bin\rar.exe" -y x
set cocolor="%~dp0bin\cocolor.exe"
set install=%adb% install
set uninstall=%adb% uninstall
set push=%adb% push
set pull=%adb% pull
set shell=%adb% shell
set twrp=%shell% twrp
if not exist "%temp%\firestick-loader" md "%temp%\firestick-loader"
:start
color 0e
:: Kill any adb instances before starting
%adbKill%
:: Set Flags For ADB Service and Unknown Sources
set adb_success=0
set unk_sources_success=0
:: TWRP Requirement
set twrp_available=0
cls
echo Looking For TWRP Recovery...
echo.
%pull% /twres/twrp "%temp%\firestick-loader"
%sleep% 2
if exist "%temp%\firestick-loader\twrp" set twrp_available=1
if %twrp_available%==1 goto intro
if %twrp_available%==0 goto twrpfail
:twrpfail
%cocolor% 0c
cls
echo TWRP Not Found!
echo.
echo Trying To Force Boot Into Recovery...
echo.
%sleep% 3
%adb% reboot recovery
%sleep% 25
goto start
:intro
:: Reset TWRP Flags
if %twrp_available%==1 del /f /q "%temp%\firestick-loader\twrp"
if %twrp_available%==1 set twrp_available=0
color 0e
set rwcheck=0
cls
echo.
echo Mounting System To Check Device Settings...
echo.
%shell% "mount -o rw /system"
echo.
echo.
echo Press 1 if there is an error, otherwise just press ENTER
echo.
set /p rwcheck=
if %rwcheck%==1 echo.
if %rwcheck%==1 echo Waiting on Reboot...
if %rwcheck%==1 echo.
if %rwcheck%==1 %adb% reboot recovery
if %rwcheck%==1 %sleep% 25
if %rwcheck%==1 goto intro
:: Get FireOS Info
%shell% "cat /system/build.prop | grep ro.build.version.name>/sdcard/fireos-version.txt"
%pull% /sdcard/fireos-version.txt "%temp%"
%shell% "cat /system/build.prop | grep ro.product.device=>/sdcard/fireos-device.txt"
%pull% /sdcard/fireos-device.txt "%temp%"
for /f "tokens=3 delims= " %%f in ('type "%temp%\fireos-version.txt"') do set fireOsVersion=%%f
for /f "tokens=2 delims==" %%f in ('type "%temp%\fireos-device.txt"') do set fireOsDevice=%%f
%sleep% 1
%shell% "rm /sdcard/fireos-version.txt"
%shell% "rm /sdcard/fireos-device.txt"
if not %fireOsDevice%==tank goto notank
cls
%cocolor% 0a
echo TWRP Found!
echo.
%cocolor% 0b
echo Device: %fireOsDevice% / Firmware Version: %fireOsVersion%
echo.
echo.
pause
goto stage1
:notank
%cocolor% 0c
cls
echo Supports Tank Only!
echo.
echo This device is %fireOsDevice% and CANNOT continue!
echo.
pause
goto end
:stage1
cls
echo.
echo Mounting System as RW for System Install...
echo.
%twrp% remountrw /system
echo.
echo Check For RW Mount Status
echo.
echo.
echo Press 1 if there is an error, otherwise just press ENTER
echo.
set /p rwcheck=
if %rwcheck%==1 echo.
if %rwcheck%==1 echo Waiting on Reboot...
if %rwcheck%==1 echo.
if %rwcheck%==1 %adb% reboot recovery
if %rwcheck%==1 %sleep% 25
if %rwcheck%==1 goto stage1
cls
echo Preparing LineageOS and Google Apps Zip Files
echo.
if not exist "%temp%\firestick-loader\install\stick2\lineageos" md "%temp%\firestick-loader\install\stick2\lineageos"
%extractRAR% "install\stick2\lineageos\lineageos-tank.split" "%temp%\firestick-loader\install\stick2"
cls
echo Pushing LineageOS and Google Apps Zip Files to /sdcard/...
echo.
%push% "%temp%\firestick-loader\install\stick2\lineageos-tank.zip" /sdcard/
%push% "%temp%\firestick-loader\install\stick2\gapps-tank.zip" /sdcard/
%sleep% 2
cls
echo Wiping System, Data, and Cache...
echo.
%twrp% wipe /data
%twrp% wipe /system
%sleep% 5
cls
echo Installing LineageOS and Google Apps...
echo.
%twrp% install /sdcard/lineageos-tank.zip
%twrp% install /sdcard/gapps-tank.zip
%sleep% 5
cls
echo Cleaning Up Files...
echo.
rd /s /q "%temp%\firestick-loader\install\stick2"
%shell% "rm /sdcard/lineageos-tank.zip"
%shell% "rm /sdcard/gapps-tank.zip"
%sleep% 5
cls
echo Installing Magisk...
echo.
%push% "rooting\%magiskZip%" /data/local/tmp/
%twrp% install /data/local/tmp/%magiskZip%
%sleep% 3
cls
echo Preparing For Reboot...
echo.
%sleep% 8
%adb% reboot
%sleep% 10
cls
echo Finished!
echo.
pause
:end