-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRun-pws.ps1
209 lines (182 loc) · 8.48 KB
/
Run-pws.ps1
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
209
$FASTBOOT = "$PSScriptRoot\..\adb\fastboot.exe"
$ADB = "$PSScriptRoot\..\adb\adb.exe"
$PayloadDumperGo = "$PSScriptRoot\..\bin\payload-dumper-go.exe"
function Show-Menu {
Write-Host ""
Write-Host "=================================================" -ForegroundColor DarkCyan
Write-Host " Flashing AIO By V " -ForegroundColor White
Write-Host "=================================================" -ForegroundColor DarkCyan
# Flash Custom ROM Section
Write-Host "== Flash Custom ROM ==" -ForegroundColor Yellow
Write-Host "[1] Adb sideload [2] Fastboot" -ForegroundColor Red
Write-Host "-----------------------------------------------" -ForegroundColor DarkGray
# Flash Images Section
Write-Host "== Flash Images ==" -ForegroundColor Yellow
Write-Host "[7] Vendor Boot [8] Boot [9] Stock ROM" -ForegroundColor Cyan
Write-Host "-----------------------------------------------" -ForegroundColor DarkGray
# Extract Section
Write-Host "== Extract ==" -ForegroundColor Yellow
Write-Host "[3] Vendor Boot [4] Boot" -ForegroundColor Green
Write-Host "-----------------------------------------------" -ForegroundColor DarkGray
# Patch Section
Write-Host "== Patch Boot ==" -ForegroundColor Yellow
Write-Host "[5] KSU [6] Magisk" -ForegroundColor Blue
Write-Host "-----------------------------------------------" -ForegroundColor DarkGray
# Miscellaneous Section
Write-Host "== Miscellaneous ==" -ForegroundColor Yellow
Write-Host "[10] Exit" -ForegroundColor Magenta
Write-Host "=================================================" -ForegroundColor DarkCyan
Write-Host ""
$selection = Read-Host "Please select an option (1-10)"
switch ($selection) {
"1" { Clear-Host; Flash-ADB }
"2" { Clear-Host; Flash-Fastboot }
"3" { Clear-Host; Extract-VendorBoot }
"4" { Clear-Host; Extract-Boot }
"5" { Clear-Host; Patch-KSU }
"6" { Clear-Host; Patch-Magisk }
"7" { Clear-Host; Flash-VB }
"8" { Clear-Host; Flash-Boot }
"9" { Clear-Host; Flash-Stock }
"10" { Clear-Host; Exit-Script }
default { Write-Host "Invalid selection. Please try again." -ForegroundColor Red; Show-Menu }
}
}
# Function to flash using adb sideload
function Flash-ADB {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Flashing Custom ROM with ADB Sideload " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "You will need to manually select 'adb sideload' in recovery." -ForegroundColor Green
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\flashADB.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to flash using fastboot
function Flash-Fastboot {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Flashing Custom ROM with Fastboot " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\flashFastboot.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to extract vendor boot
function Extract-VendorBoot {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Extracting Vendor Boot Image " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\extractVendorBoot.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to extract boot image
function Extract-Boot {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Extracting Boot Image " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\extractBoot.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to patch KSU
function Patch-KSU {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Patching Boot with KSU " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Boot into fastbootd mode for patching." -ForegroundColor Green
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\patchKSU.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to patch Boot with Magisk
function Patch-Magisk {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Patching Boot with Magisk " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\patchMagisk.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to flash Vendor boot
function Flash-VB {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Flashing Vendor Boot " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\flashVB.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to flash Boot
function Flash-Boot {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Flashing Boot Image " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\flashB.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to flash Stock ROM
function Flash-Stock {
Write-Host ""
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " Flashing Stock ROM " -ForegroundColor Yellow
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Extract flashing-AIO and stock firmware in the same folder." -ForegroundColor Green
Write-Host "Press Enter to continue..." -ForegroundColor Magenta
$null = Read-Host
& "$PSScriptRoot\bats\flashStock.cmd"
Write-Host "===================================" -ForegroundColor Cyan
Write-Host "Press Enter to return to the Main Menu." -ForegroundColor Green
$null = Read-Host
Show-Menu
}
# Function to exit the script
function Exit-Script {
Write-Host "===================================" -ForegroundColor Red
Write-Host " Exiting the Script... " -ForegroundColor White
Write-Host "===================================" -ForegroundColor Red
exit
}
# Start the Menu
Show-Menu