-
Notifications
You must be signed in to change notification settings - Fork 20
/
prepare.ps1
64 lines (52 loc) · 1.93 KB
/
prepare.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
param (
[string]$ABI = "arm64-v8a",
[string]$pluginName = "libPlugins.so",
[bool]$cleanDir = $false,
[bool]$pushQBDI = $true
)
if ($ABI -ne "armeabi-v7a" -and $ABI -ne "arm64-v8a") {
Write-Host "Invalid ABI: $($ABI)" -ForegroundColor Red
Write-Host "ABI must be either armeabi-v7a or arm64-v8a" -ForegroundColor Red
exit 1
}
if (-not (Get-Command "adb" -ErrorAction SilentlyContinue)) {
Write-Host "adb not found" -ForegroundColor Red
return
}
if (-not (Get-Command "npm" -ErrorAction SilentlyContinue)) {
Write-Host "npm not found" -ForegroundColor Red
return
}
$soPath = Join-Path $PSScriptRoot "/agent/plugins/$($ABI)/$($pluginName)"
Write-Host "building PATH: agent/plugins/$($ABI)/$($pluginName)" -ForegroundColor Green
& $PSScriptRoot/agent/plugins/buildScript.ps1 -SOURCE $PSScriptRoot/agent/plugins -ABI $ABI
& adb push $soPath /data/local/tmp
& adb shell chmod 777 /data/local/tmp/libPlugins.so
if ($pushQBDI) {
$dirItems = adb shell ls /data/local/tmp
if ($ABI -eq "armeabi-v7a") {
if ($dirItems -like "libQBDI_32.so") {
Write-Host "libQBDI_32.so exists" -ForegroundColor Green
}
else {
$arm32_lib = Join-Path $PSScriptRoot "agent/plugins/QBDI/armeabi-v7a/lib/libQBDI.so"
adb push $arm32_lib /data/local/tmp/libQBDI_32.so
adb shell chmod 777 /data/local/tmp/libQBDI_32.so
}
}
if ($ABI -eq "arm64-v8a") {
if ($dirItems -like "libQBDI_64.so") {
Write-Host "libQBDI_64.so exists" -ForegroundColor Green
}
else {
$arm64_lib = Join-Path $PSScriptRoot "agent/plugins/QBDI/arm64-v8a/lib/libQBDI.so"
adb push $arm64_lib /data/local/tmp/libQBDI_64.so
adb shell chmod 777 /data/local/tmp/libQBDI_64.so
}
}
}
& adb shell setenforce 0
if ($cleanDir) {
Remove-Item (Split-Path $soPath) -Recurse -Force
}
npm install & npm run build