-
Notifications
You must be signed in to change notification settings - Fork 117
/
push.sh
executable file
·41 lines (36 loc) · 1.33 KB
/
push.sh
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
#!/bin/bash
while getopts ":-:" o; do
case "${OPTARG}" in
reboot)
REBOOT=1
;;
use_remount)
USE_REMOUNT=1
;;
esac
done
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}" = "1" ]]; then
adb wait-for-device shell "remount"
elif [[ "$(adb shell stat -f --format %a /system)" = "0" ]]; then
echo "ERROR: /system has 0 available blocks, consider using --use_remount"
exit -1
else
adb wait-for-device shell "stat --format %m /system | xargs mount -o rw,remount"
fi
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 [[ -f "system/etc/ih8sn.conf.${SERIALNO}" ]]; then
adb wait-for-device push system/etc/ih8sn.conf.${SERIALNO} /system/etc/ih8sn.conf
elif [[ -f "system/etc/ih8sn.conf.${PRODUCT}" ]]; then
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/
fi
if [[ "${REBOOT}" = "1" ]]; then
adb wait-for-device reboot
fi