starthugep.sh 1.54 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
        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
41
            unzip_go -file /system/bin/hugep-all.zip -dst /data/smallp/
fuyanbin's avatar
fuyanbin committed
42
43
            unzip_go -file /system/bin/manager_bin_file.zip -dst /data/smallp/
        fi
44
45
46
47
    elif [ -d /system/smallp ]
    then
        cp -rf /system/smallp /data/
    fi
fuyanbin's avatar
fuyanbin committed
48
49
50
51
52
53
54

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

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