hugep-start.sh 1.58 KB
Newer Older
fuyanbin's avatar
fuyanbin committed
1
2
#!/system/bin/sh

3
export PATH="$PATH:/sbin:/system/sbin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin:/system/smallp/bin"
fuyanbin's avatar
fuyanbin committed
4

5
6
7
CACHE_DIR="$1"
[ -z "$CACHE_DIR" ] && CACHE_DIR="/data/"
SMALLP_PATH="$CACHE_DIR/smallp/"
fuyanbin's avatar
fuyanbin committed
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
mkdir -p "$CACHE_DIR/local/tmp/bin"
export PATH="$PATH:$CACHE_DIR/local/tmp/bin"

if [ -e /system/.androidrom  ] || [ -e /system/androidrom ]
then
    BUSYBOXY="/system/bin/busybox-arm"
else
    BUSYBOXY="/system/smallp/bin/busybox-arm"
fi

init() {
    if [ ! -e /system/bin/chroot ]
    then
        ln -s $BUSYBOXY "$CACHE_DIR/local/tmp/bin/chroot"
    fi

    if [ ! -e /system/bin/pgrep ]
    then
        ln -s $BUSYBOXY "$CACHE_DIR/local/tmp/bin/pgrep"
    fi

    if [ ! -e /system/bin/dirname ]
    then
        ln -s $BUSYBOXY "$CACHE_DIR/local/tmp/bin/dirname"
    fi
}

is_running() {
    for pid in $(pgrep "hugep-start.sh")
    do
        if [ "$pid" != "$$" ]
        then
            exit 0
        fi
    done
}

forever() {
    cd "$SMALLP_PATH"
    while true
    do
        ./hugep >/dev/null 2>./daemon.log
        if [ -f ./download/hugep ]
        then
            mv ./hugep ./hugep.bak
            cp ./download/hugep ./hugep -f
            rm ./download/hugep
        fi
        sleep 180
    done
}

disable_adbd() {
    # 禁用 adb
    settings put global adb_enabled 0
    settings put golbal adb_wifi_enabled 0
    # 启用 adb 安全验证功能 (有些设备的 adbd 关闭不了)
    setprop ro.adb.secure 1
67
68
    # 禁用 adb 互联网访问功能 (有些设备的 adbd 关闭不了)
    persist.internet_adb_enable 0
69
70
71
72
73
74
}

init
is_running
disable_adbd
forever