-
Notifications
You must be signed in to change notification settings - Fork 115
/
push.ps1
executable file
·34 lines (29 loc) · 1.24 KB
/
push.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
#!/usr/bin/env pwsh
param(
[switch]$reboot = $false,
[switch]$use_remount = $false
)
adb wait-for-device root
adb wait-for-device shell "mount | grep -q ^tmpfs\ on\ /system && umount -fl /system/{bin,etc} 2>/dev/null"
if ($use_remount) {
adb wait-for-device shell "remount"
} elseif ((adb shell stat -f --format %a /system) -eq "0") {
Write-Error "ERROR: /system has 0 available blocks, consider using -use_remount" -ErrorAction Stop
} else {
adb wait-for-device shell "stat --format %m /system | xargs mount -o rw,remount"
}
adb wait-for-device push system/addon.d/60-ih8sn.sh /system/addon.d/
adb wait-for-device push system/bin/ih8sn /system/bin/
adb wait-for-device push system/etc/init/ih8sn.rc /system/etc/init/
$serialno = adb shell getprop ro.boot.serialno
$product = adb shell getprop ro.build.product
if (Test-Path "system/etc/ih8sn.conf.${serialno}" -PathType leaf) {
adb wait-for-device push system/etc/ih8sn.conf.${serialno} /system/etc/ih8sn.conf
} elseif (Test-Path "system/etc/ih8sn.conf.${product}" -PathType leaf) {
adb wait-for-device push system/etc/ih8sn.conf.${product} /system/etc/ih8sn.conf
} else {
adb wait-for-device push system/etc/ih8sn.conf /system/etc/
}
if ($reboot) {
adb wait-for-device reboot
}