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 elif [[ $(echo "$1" | grep "^BUILDTYPE=") != "" ]]; | |
mtklein
2014/04/03 14:26:37
I'd prefer just
elif echo $1 | grep -q ^BUILDT
| |
23 then | |
24 BUILDTYPE=${1##BUILDTYPE=} | |
22 else | 25 else |
23 APP_ARGS=("${APP_ARGS[@]}" "${1}") | 26 APP_ARGS=("${APP_ARGS[@]}" "${1}") |
24 fi | 27 fi |
25 | 28 |
26 shift | 29 shift |
27 done | 30 done |
28 | 31 |
29 function verbose { | 32 function verbose { |
30 if [[ -n $SKIA_ANDROID_VERBOSE_SETUP ]]; then | 33 if [[ -n $SKIA_ANDROID_VERBOSE_SETUP ]]; then |
31 echo $@ | 34 echo $@ |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 else | 340 else |
338 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | 341 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST |
339 fi | 342 fi |
340 } | 343 } |
341 | 344 |
342 # Set up the device. | 345 # Set up the device. |
343 setup_device "${DEVICE_ID}" | 346 setup_device "${DEVICE_ID}" |
344 if [[ "$?" != "0" ]]; then | 347 if [[ "$?" != "0" ]]; then |
345 exit 1 | 348 exit 1 |
346 fi | 349 fi |
OLD | NEW |