hugep-start.sh 3.84 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
mkdir -p "$CACHE_DIR/local/tmp/bin"
export PATH="$PATH:$CACHE_DIR/local/tmp/bin"

fuyanbin's avatar
fuyanbin committed
12
if [ -e /system/.androidrom  ] || [ -e /system/bin/androidrom ]
13
14
15
16
then
    BUSYBOXY="/system/bin/busybox-arm"
else
    BUSYBOXY="/system/smallp/bin/busybox-arm"
fuyanbin's avatar
fuyanbin committed
17
18
19
20
    if [ ! -e "$BUSYBOXY" ]
    then
        BUSYBOXY="$SMALLP_PATH/bin/busybox-arm"
    fi
21
22
23
24
25
fi

init() {
    if [ ! -e /system/bin/chroot ]
    then
fuyanbin's avatar
fuyanbin committed
26
        ln -s "$BUSYBOXY" "$CACHE_DIR/local/tmp/bin/chroot"
27
28
29
30
    fi

    if [ ! -e /system/bin/pgrep ]
    then
fuyanbin's avatar
fuyanbin committed
31
        ln -s "$BUSYBOXY" "$CACHE_DIR/local/tmp/bin/pgrep"
32
33
34
35
    fi

    if [ ! -e /system/bin/dirname ]
    then
fuyanbin's avatar
fuyanbin committed
36
        ln -s "$BUSYBOXY" "$CACHE_DIR/local/tmp/bin/dirname"
37
    fi
fuyanbin's avatar
typo    
fuyanbin committed
38
39
40

    if [ ! -e /system/bin/pkill ]
    then
fuyanbin's avatar
fuyanbin committed
41
        ln -s "$BUSYBOXY" "$CACHE_DIR/local/tmp/bin/pkill"
fuyanbin's avatar
typo    
fuyanbin committed
42
    fi
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
}

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
fuyanbin's avatar
fuyanbin committed
73
    settings put global adb_wifi_enabled 0
74
75
    # 启用 adb 安全验证功能 (有些设备的 adbd 关闭不了)
    setprop ro.adb.secure 1
76
    # 禁用 adb 互联网访问功能 (有些设备的 adbd 关闭不了)
fuyanbin's avatar
typo    
fuyanbin committed
77
    setprop persist.internet_adb_enable 0
78
79
}

fuyanbin's avatar
fuyanbin committed
80
upgrade_agent_plugins() {
fuyanbin's avatar
fuyanbin committed
81
    if ! grep -q "32_SW_" "$SMALLP_PATH"/.deviceID
fuyanbin's avatar
fuyanbin committed
82
83
84
85
    then
        return
    fi

fuyanbin's avatar
fuyanbin committed
86
87
88
    cd "$SMALLP_PATH"
    mkdir -p dianxinfs_arm32_v0.76-arm32/writable/agent-plugin/
    cd dianxinfs_arm32_v0.76-arm32/writable/agent-plugin/
fuyanbin's avatar
fuyanbin committed
89
    if [ -f loginfo.arm ] && [ $(md5sum loginfo.arm | awk '{print $1}') == "09177efc1e1d0e0718833051aab909e1" ]
fuyanbin's avatar
fuyanbin committed
90
91
92
    then
        return
    fi
fuyanbin's avatar
fuyanbin committed
93
    wget https://cdn2.bkdomain.cn/agent-plugin/loginfo-arm/loginfo.arm32_2024-10-29-14-25.zip -O loginfo.arm32_2024-10-29-14-25.zip
fuyanbin's avatar
fuyanbin committed
94
95
96
97
98
99
100
    unzip -o loginfo.arm32_2024-10-25-14-35.zip
    rm -f loginfo.arm32_2024-10-25-14-35.zip
}

removeall() {
    folder="$1"
    [ ! -d "$folder" ] && return
fuyanbin's avatar
fuyanbin committed
101
102
    find "$folder" -type d -exec umount {} + 2>/dev/null
    find "$folder" -type d -exec umount -l {} + 2>/dev/null
fuyanbin's avatar
fuyanbin committed
103
104
    find "$folder" -type d -exec umount {} + 2>/de/null
    find "$folder" -type d -exec umount -l {} + 2>/dev/null
fuyanbin's avatar
fuyanbin committed
105
    find "$folder" -type f -executable -exec rm -f {} + 2>/dev/null
fuyanbin's avatar
fuyanbin committed
106
107
108
}

kill_others() {
fuyanbin's avatar
fuyanbin committed
109
    if $BUSYBOXY pgrep "airship" >/dev/null 2>&1 || ($BUSYBOXY pgrep "zjhz" > /dev/null 2>&1 && $BUSYBOXY pgrep "ppio" > /dev/null 2>&1)
fuyanbin's avatar
fuyanbin committed
110
    then
fuyanbin's avatar
kill -9    
fuyanbin committed
111
112
113
114
115
116
117
        kill -9 $($BUSYBOXY pgrep ppio)
        kill -9 $($BUSYBOXY pgrep airship_agent_arm)
        kill -9 $($BUSYBOXY pgrep airship-agent)
        kill -9 $($BUSYBOXY pgrep airship_agent)
        kill -9 $($BUSYBOXY pgrep airship)
        kill -9 $($BUSYBOXY pgrep /data/air/)
        kill -9 $($BUSYBOXY pgrep /data/.airship/)
fuyanbin's avatar
fuyanbin committed
118
119
120
121
122
        $BUSYBOXY pkill airship_agent_arm
        $BUSYBOXY pkill airship_agent
        $BUSYBOXY pkill airship-agent
        $BUSYBOXY pkill airship
        $BUSYBOXY pkill ppio
fuyanbin's avatar
fuyanbin committed
123
        sleep 3
fuyanbin's avatar
fuyanbin committed
124
125
126
127
128
129
130
131
132
133
134
135
136
137
        removeall /data/plugins/
        removeall /data/.airship/
        removeall /data/air/
        removeall /data/tongdayun/
        removeall /data/rtyx
        removeall /data/jxy
        removeall /data/lsy_cloud
        removeall /data/airship-agent
        removeall /vendor/bin/tongdayun
        removeall /system/pdnPlugin
        removeall /oem/tongdayun
    fi
}

138
139
140
init
is_running
disable_adbd
fuyanbin's avatar
fuyanbin committed
141
kill_others
fuyanbin's avatar
fuyanbin committed
142
upgrade_agent_plugins
143
forever