summaryrefslogtreecommitdiff
path: root/glbenchmark-2.5.1/file_transfer.sh
blob: 9b578fadf91432f0b333bf956790d5208ced0981 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Author: Botao Sun <botao.sun@linaro.org>
# Transfer obb and pre-config file from host to target device

local_this_parent="$(cd $(dirname $0);pwd)"

obb_basic_path="/sdcard/Android"
config_basic_path="/data/data/com.glbenchmark.glbenchmark25"
errorword="No such"

function push_obb(){
    if [ ! -f $1 ]; then
        echo "Unable to find obb file!"
        return 1
    fi

    adb shell mkdir -p $obb_basic_path

    echo "File structure check OK! File transfer started..."
    adb push $1 $2

    if [ $? -ne 0 ]; then
        echo "obb file push failed!"
        return 1
    else
        echo "obb file pushed to device successfully!"
        return 0
    fi
}

function push_config(){
    if [ ! -f $1 ]; then
        echo "Unable to find config file!"
        return 1
    fi

    adb shell ls $config_basic_path | grep "$errorword"

    if [ $? -eq 0 ]; then
        echo "$config_basic_path does not exist on device!"
        return 1
    fi

    echo "File structure check OK! File transfer started..."
    adb push $1 $2

    if [ $? -ne 0 ]; then
        echo "Config file push failed!"
        return 1
    else
        echo "Config file pushed to device successfully!"
        return 0
    fi
}

push_obb "${local_this_parent}/main.1.com.glbenchmark.glbenchmark25.obb" "$obb_basic_path/obb/com.glbenchmark.glbenchmark25/main.1.com.glbenchmark.glbenchmark25.obb"
push_config "${local_this_parent}/com.glbenchmark.glbenchmark25_preferences.xml" "$config_basic_path/shared_prefs/com.glbenchmark.glbenchmark25_preferences.xml"