OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # android_setup.sh: Sets environment variables used by other Android scripts. | 3 # android_setup.sh: Sets environment variables used by other Android scripts. |
4 | 4 |
5 # Parse the arguments for a DEVICE_ID. | 5 # Parse the arguments for a DEVICE_ID. |
6 DEVICE_ID="" | 6 DEVICE_ID="" |
7 DEVICE_SERIAL="" | 7 DEVICE_SERIAL="" |
8 while (( "$#" )); do | 8 while (( "$#" )); do |
9 if [[ $(echo "$1" | grep "^-d$") != "" ]]; | 9 if [[ $(echo "$1" | grep "^-d$") != "" ]]; |
10 then | 10 then |
11 DEVICE_ID=$2 | 11 DEVICE_ID=$2 |
12 shift | 12 shift |
13 elif [[ "$1" == "-s" ]]; | 13 elif [[ "$1" == "-s" ]]; |
14 then | 14 then |
15 if [[ $# -lt 2 ]]; | 15 if [[ $# -lt 2 ]]; |
16 then | 16 then |
17 echo "ERROR: missing serial number" | 17 echo "ERROR: missing serial number" |
18 exit 1; | 18 exit 1; |
19 fi | 19 fi |
20 DEVICE_SERIAL="-s $2" | 20 DEVICE_SERIAL="-s $2" |
21 shift | 21 shift |
22 else | 22 else |
23 APP_ARGS=("${APP_ARGS[@]}" "${1}") | 23 APP_ARGS=("${APP_ARGS[@]}" "${1}") |
24 fi | 24 fi |
25 | 25 |
26 shift | 26 shift |
27 done | 27 done |
28 | 28 |
29 function verbose { | 29 function verbose { |
30 if [[ -n $VERBOSE ]]; then | 30 if [[ -n $SKIA_ANDROID_VERBOSE_SETUP ]]; then |
31 echo $@ | 31 echo $@ |
32 fi | 32 fi |
33 } | 33 } |
34 | 34 |
35 function exportVar { | 35 function exportVar { |
36 NAME=$1 | 36 NAME=$1 |
37 VALUE=$2 | 37 VALUE=$2 |
38 verbose export $NAME=\"$VALUE\" | 38 verbose export $NAME=\"$VALUE\" |
39 export $NAME="$VALUE" | 39 export $NAME="$VALUE" |
40 } | 40 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 else | 323 else |
324 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | 324 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST |
325 fi | 325 fi |
326 } | 326 } |
327 | 327 |
328 # Set up the device. | 328 # Set up the device. |
329 setup_device "${DEVICE_ID}" | 329 setup_device "${DEVICE_ID}" |
330 if [[ "$?" != "0" ]]; then | 330 if [[ "$?" != "0" ]]; then |
331 exit 1 | 331 exit 1 |
332 fi | 332 fi |
OLD | NEW |