OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 ############################################################################### | 2 ############################################################################### |
3 # Copyright 2015 Google Inc. | 3 # Copyright 2015 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 ############################################################################### | 7 ############################################################################### |
8 # | 8 # |
9 # android_setup.sh: Sets environment variables used by other Android scripts. | 9 # android_setup.sh: Sets environment variables used by other Android scripts. |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` | 213 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` |
214 HOST_LS=`ls -ld $HOST_SRC` | 214 HOST_LS=`ls -ld $HOST_SRC` |
215 if [ "${ANDROID_LS:0:1}" == "d" -a "${HOST_LS:0:1}" == "-" ]; | 215 if [ "${ANDROID_LS:0:1}" == "d" -a "${HOST_LS:0:1}" == "-" ]; |
216 then | 216 then |
217 ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" | 217 ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" |
218 fi | 218 fi |
219 | 219 |
220 | 220 |
221 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` | 221 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` |
222 if [ "${ANDROID_LS:0:1}" == "-" ]; then | 222 if [ "${ANDROID_LS:0:1}" == "-" ]; then |
223 #get the MD5 for dst and src | 223 #get the MD5 for dst and src depending on OS and/or OS revision |
224 ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST` | 224 ANDROID_MD5_SUPPORT=`$ADB $DEVICE_SERIAL shell ls -ld /system/bin/md5` |
| 225 if [ "${ANDROID_MD5_SUPPORT:0:15}" != "/system/bin/md5" ]; then |
| 226 ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST` |
| 227 else |
| 228 ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5sum $ANDROID_DST` |
| 229 fi |
| 230 |
225 if [ $(uname) == "Darwin" ]; then | 231 if [ $(uname) == "Darwin" ]; then |
226 HOST_MD5=`md5 -q $HOST_SRC` | 232 HOST_MD5=`md5 -q $HOST_SRC` |
227 else | 233 else |
228 HOST_MD5=`md5sum $HOST_SRC` | 234 HOST_MD5=`md5sum $HOST_SRC` |
229 fi | 235 fi |
230 | 236 |
231 if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then | 237 if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then |
232 echo -n "$ANDROID_DST " | 238 echo -n "$ANDROID_DST " |
233 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | 239 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST |
234 fi | 240 fi |
235 elif [ "${ANDROID_LS:0:1}" == "d" ]; then | 241 elif [ "${ANDROID_LS:0:1}" == "d" ]; then |
236 for FILE_ITEM in `ls $HOST_SRC`; do | 242 for FILE_ITEM in `ls $HOST_SRC`; do |
237 adb_push_if_needed "${HOST_SRC}/${FILE_ITEM}" "${ANDROID_DST}/${FILE_ITEM}
" | 243 adb_push_if_needed "${HOST_SRC}/${FILE_ITEM}" "${ANDROID_DST}/${FILE_ITEM}
" |
238 done | 244 done |
239 else | 245 else |
240 HOST_LS=`ls -ld $HOST_SRC` | 246 HOST_LS=`ls -ld $HOST_SRC` |
241 if [ "${HOST_LS:0:1}" == "d" ]; then | 247 if [ "${HOST_LS:0:1}" == "d" ]; then |
242 $ADB $DEVICE_SERIAL shell mkdir -p $ANDROID_DST | 248 $ADB $DEVICE_SERIAL shell mkdir -p $ANDROID_DST |
243 adb_push_if_needed $HOST_SRC $ANDROID_DST | 249 adb_push_if_needed $HOST_SRC $ANDROID_DST |
244 else | 250 else |
245 echo -n "$ANDROID_DST " | 251 echo -n "$ANDROID_DST " |
246 $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" | 252 $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" |
247 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | 253 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST |
248 fi | 254 fi |
249 fi | 255 fi |
250 } | 256 } |
251 | 257 |
252 setup_device "${DEVICE_ID}" | 258 setup_device "${DEVICE_ID}" |
OLD | NEW |