forked from ma34s/g2_cwm_install_tool
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrunme.bat
executable file
·145 lines (122 loc) · 3.88 KB
/
runme.bat
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
@echo off
for /f "tokens=3 delims= " %%a in ('chcp') do set lang=%%a
if "%lang%" == "932" (set doc="%~dp0doc\jp") else (set doc="%~dp0doc\en")
SET adb="%~dp0bin\adb.exe"
mode con:cols=80 lines=40
type %doc%\"01_Thanks.txt"
pause
%adb% shell id
IF %ERRORLEVEL% neq 0 goto device_not_found
call :adb_push
:menu
COLOR 0A
type %doc%\"08_menu.txt"
SET INPUT=
set /P INPUT=Num :
if "%INPUT%" == "1" call :backup
if "%INPUT%" == "2" call :install_recovery
if "%INPUT%" == "3" call :install_su
if "%INPUT%" == "9" goto finish
goto menu
::==============================================================
:finish
COLOR 07
call :clean
type %doc%\"02_End.txt"
pause
exit /b
::==============================================================
:device_not_found
COLOR 0C
type %doc%\"09_Error_device_not_found.txt"
pause
exit /b
::==============================================================
:adb_push
%adb% push "%~dp0files\tmproot" /data/local/tmp/
::IF %ERRORLEVEL% neq 0 exit /b 1
%adb% shell chmod 755 /data/local/tmp/busybox_file
:: rooting
%adb% shell chmod 755 /data/local/tmp/get_essential_address
%adb% shell chmod 755 /data/local/tmp/unlock_security_module
%adb% shell chmod 755 /data/local/tmp/run_root_shell
%adb% shell chmod 755 /data/local/tmp/run_root.sh
exit /b
::==============================================================
:backup
CLS
COLOR 0B
type %doc%\"06_backup.txt"
set /P INPUT=(N/y):
if "%INPUT%" == "Y" call :backup_core
if "%INPUT%" == "y" call :backup_core
exit /b
:backup_core
echo prepear for backup
%adb% push "%~dp0files\backup" /data/local/tmp/
%adb% shell chmod 755 /data/local/tmp/backup.sh
echo start backup
type %doc%\"07_warning_backup.txt"
%adb% shell /data/local/tmp/run_root.sh /data/local/tmp/backup.sh
echo save to PC
mkdir %~dp0backups
%adb% pull /sdcard/backup/ "%~dp0backups"
pause
exit /b
::==============================================================
:install_recovery
CLS
COLOR 0D
type %doc%\"03_warning.txt"
set /P INPUT=(N/y):
if "%INPUT%"=="Y" call :install_recovery_core
if "%INPUT%"=="y" call :install_recovery_core
exit /b
:install_recovery_core
echo prepear for install recovery
%adb% shell mkdir -p /data/local/tmp/recovery
%adb% shell mkdir -p /data/local/tmp/loki
%adb% push "%~dp0files\recovery" /data/local/tmp/recovery
%adb% push "%~dp0files\loki" /data/local/tmp/loki
:: loki
%adb% shell chmod 755 /data/local/tmp/loki/loki.sh
%adb% shell chmod 755 /data/local/tmp/loki/loki_tool
echo start instrall recovery
%adb% shell /data/local/tmp/run_root.sh /data/local/tmp/loki/loki.sh
pause
exit /b
::==============================================================
:install_su
CLS
COLOR 0E
type %doc%\"04_warning_su.txt"
set /P INPUT=(N/y):
if "%INPUT%" == "Y" call :install_su_core
if "%INPUT%" == "y" call :install_su_core
exit /b
:install_su_core
echo prepear for gettting the permanent root
%adb% shell mkdir -p /data/local/tmp/SuperSu
%adb% push "%~dp0files\SuperSu" /data/local/tmp/SuperSu
%adb% shell chmod 755 /data/local/tmp/SuperSu/install_su.sh
%adb% shell chmod 755 /data/local/tmp/SuperSu/install-busybox.sh
echo install su binaries
%adb% shell /data/local/tmp/run_root.sh /data/local/tmp/SuperSu/install_su.sh
%adb% shell /data/local/tmp/run_root_shell -c "reboot recovery"
type %doc%\"05_reboot.txt"
%adb% wait-for-device
call :adb_push
pause
exit /b
::==============================================================
:clean
%adb% shell rm /data/local/tmp/busybox_file
%adb% shell rm /data/local/tmp/device.db
%adb% shell rm /data/local/tmp/get_essential_address
%adb% shell rm /data/local/tmp/run_root.sh
%adb% shell rm /data/local/tmp/run_root_shell
%adb% shell rm /data/local/tmp/unlock_security_module
%adb% shell rm -rf /data/local/tmp/loki
%adb% shell rm -rf /data/local/tmp/recovery
%adb% shell rm -rf /data/local/tmp/SuperSu
exit /b