starthugep.sh 1.47 KB
Newer Older
fuyanbin's avatar
fuyanbin committed
1
#!/system/bin/sh
2

fuyanbin's avatar
fuyanbin committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
export PATH="$PATH:/sbin:/system/sbin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin"

BUSYBOXY="/data/local/bin/busybox-arm"

if [ ! -e /system/bin/chroot ]
then
    ln -s $BUSYBOXY /system/bin/chroot
fi

if [ -e /data/local/bin/pgrep ]
then
    PGREP="/data/local/bin/pgrep"
else
    PGREP="pgrep"
fi

if [ ! -e /system/bin/dirname ]
then
    ln -s $BUSYBOXY /system/bin/dirname
fi

for pid in $($PGREP "starthugep.sh")
do
    if [ "$pid" != "$$" ]
27
    then
fuyanbin's avatar
fuyanbin committed
28
        exit 0
29
    fi
fuyanbin's avatar
fuyanbin committed
30
done
fuyanbin's avatar
fuyanbin committed
31

32
33
34
35
if [ -e /system/.androidrom  ] && [ ! -d /data/smallp ];then
    if [ -f /system/bin/hugep-all.zip ]
    then
        mkdir /data/smallp
fuyanbin's avatar
fuyanbin committed
36
37
38
39
40
41
42
        if [ -f /system/bin/unzip ]
        then
            unzip /system/bin/hugep-all.zip -d /data/smallp
            unzip /system/bin/manager_bin_file.zip -d /data/smallp/
        else
            unzip_go -file /system/bin/manager_bin_file.zip -dst /data/smallp/
        fi
43
44
45
46
    elif [ -d /system/smallp ]
    then
        cp -rf /system/smallp /data/
    fi
fuyanbin's avatar
fuyanbin committed
47
48
49
50
51
52
53

    if [ -f /data/smallp/config.json ]
    then
        touch /data/smallp/unzip.done
    else
        rm -rf /data/smallp
    fi
54
55
56
57
58
59
60
61
62
63

    if [ -e /system/bin/hugep-start.sh ]
    then
        cp /system/bin/hugep-start.sh /data/smallp/hugep-star.sh
    fi
else
    sleep 30
fi

chmod 777 /data/smallp/hugep-start.sh
fuyanbin's avatar
fuyanbin committed
64
65
while true
do
fuyanbin's avatar
fuyanbin committed
66
        pid=$($PGREP "hugep-start.sh")
fuyanbin's avatar
fuyanbin committed
67
68
69
70
71
        if [ -z "$pid" ]; then
            /data/smallp/hugep-start.sh  > /dev/null 2>&1 &
        fi
        sleep 30
done