summaryrefstree
path: root/system/bin/jaccopyfile.sh
blob: fe80cda74b8359f7eb4f30380aa3c8096c01e9d1 (plain)
1
2
3
4
5
6
7
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
#! /system/bin/sh

## jancar copy customer source file to in-sdcard

src_path=
dest_path=

while true; do
    src_path=$(getprop jancar.copyfile.src_path)
    dest_path=$(getprop jancar.copyfile.dest_path)

    if [ -n "$src_path" ]; then
        echo "exit while true src_path:$src_path"
        if [ -n "$dest_path" ]; then
            break
        fi
    fi
done

echo "src_path:$src_path"
echo "dest_path:$dest_path"

if [ -d $src_path ]; then
    echo "start copy file"
    setprop service.jancar.copyfile.status 1
    am broadcast -a action.jancar.copyfile.start
    cp -rvf $src_path/. $dest_path
else
    exit -1
fi

if [ 0 == $? ]; then
    setprop service.jancar.copyfile.status 0
    am broadcast -a action.jancar.copyfile.complete
else
    am broadcast -a action.jancar.copyfile.error
    setprop service.jancar.copyfile.status -1
fi

echo "end jaccopyfile.sh return $?"