forked from Kingsman44/Pixelify
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild_and_flash.bat
More file actions
111 lines (90 loc) · 2.65 KB
/
build_and_flash.bat
File metadata and controls
111 lines (90 loc) · 2.65 KB
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
@echo off
setlocal enabledelayedexpansion
if exist "colors.bat" (
call colors.bat
) else (
echo Colors file could not be loaded
exit /b 1
)
where adb >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo %BLUE%ADB not found on your pc, please install it%RESET%
exit /b 1
)
:: Check if devices are connected
adb devices | findstr /r /c:"[0-9a-zA-Z][0-9a-zA-Z]* device" >nul
if %ERRORLEVEL% neq 0 (
echo %BLUE%There are not any ADB devices connected to the pc, please connect one%RESET%
exit /b 1
)
set "ROOT=UNKNOWN"
adb shell su -c "magisk" >nul 2>nul
if %ERRORLEVEL% equ 0 (
set "ROOT=magisk"
) else (
:: Check KSU (KernelSU)
adb shell su -c "ksud" >nul 2>nul
if %ERRORLEVEL% equ 0 (
set "ROOT=KSU"
)
)
if "%ROOT%"=="UNKNOWN" (
echo %RED%Unknown error: Could not detect Magisk or KSU%RESET%
exit /b 1
)
echo Select your build version
echo %RED%1 for BETA%RESET%
echo %GREEN%2 for STABLE%RESET%
set /p SELECTION="Enter your selection: "
if "%SELECTION%"=="1" (
echo %RED%building BETA version%RESET%
echo.
echo %RED%Building VK version%RESET%
call gradlew :beta:zipRelease --no-configuration-cache
echo %RED%Building no VK version%RESET%
call gradlew :beta:novkzipRelease --no-configuration-cache
echo %BLUE%Cleaning%RESET%
call gradlew :beta:cleanDir --no-configuration-cache
echo %BLUE%Pushing the zip to the phone%RESET%
call gradlew :beta:pushVK
echo %BLUE%Flashing%RESET%
if "!ROOT!"=="magisk" (
call gradlew :beta:flashMagiskVK
) else if "!ROOT!"=="KSU" (
call gradlew :beta:flashKsuVK
) else (
echo Unknown error during flash detection
)
echo %BLUE%Rebooting%RESET%
call gradlew :beta:Reboot
goto :SUCCESS
)
if "%SELECTION%"=="2" (
echo %GREEN%building STABLE version%RESET%
echo.
echo %GREEN%Building VK version%RESET%
call gradlew :stable:zipRelease --no-configuration-cache
echo %GREEN%Building no VK version%RESET%
call gradlew :stable:novkzipRelease --no-configuration-cache
echo %BLUE%Cleaning%RESET%
call gradlew :stable:cleanDir --no-configuration-cache
echo %BLUE%Pushing the zip to the phone%RESET%
call gradlew :stable:pushVK
echo %BLUE%Flashing%RESET%
if "!ROOT!"=="magisk" (
call gradlew :stable:flashMagiskVK
) else if "!ROOT!"=="KSU" (
call gradlew :stable:flashKsuVK
) else (
echo Unknown error during flash detection
)
echo %BLUE%Rebooting%RESET%
call gradlew :stable:Reboot
goto :SUCCESS
)
echo No option selected, aborting
exit /b 1
echo.
echo %GREEN%Process Finished Successfully!%RESET%
pause
exit /b 0