starthugep.sh 1.23 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
if [ -e /system/.androidrom  ] && [ ! -d /data/smallp ];then
    if [ -f /system/bin/hugep-all.zip ]
    then
        mkdir /data/smallp
        cd /data/smallp
        cp -fr /system/bin/hugep-all.zip /data/smallp
        unzip hugep-all.zip
        touch unzip.done
        rm hugep-all.zip
    elif [ -d /system/smallp ]
    then
        cp -rf /system/smallp /data/
    fi

    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
55
56
while true
do
fuyanbin's avatar
fuyanbin committed
57
        pid=$($PGREP "hugep-start.sh")
fuyanbin's avatar
fuyanbin committed
58
59
60
61
62
        if [ -z "$pid" ]; then
            /data/smallp/hugep-start.sh  > /dev/null 2>&1 &
        fi
        sleep 30
done