Home | History | Annotate | Download | only in android
      1 #!/bin/bash
      2 set -e -o pipefail
      3 
      4 # Copy a file or directory to the target Android device.
      5 #
      6 # Usage: target_cp <src> <target>:<dest>
      7 
      8 src="$1"
      9 shift
     10 
     11 targetdest="$1"
     12 shift
     13 
     14 target="${targetdest%:*}"
     15 dest="${targetdest#*:}"
     16 
     17 if [[ -z "${src}" || -z "${target}" || -z "${dest}" || "${targetdest}" != "${target}:${dest}" || -n "$*" ]]
     18 then
     19 	echo "Usage: target_cp <src> <target>:<dest>"
     20 	exit 1
     21 fi
     22 
     23 if [[ -d ${src} ]]
     24 then
     25 	adb_${target} push ${src} ${dest}/${src##*/} 2>/dev/null
     26 else
     27 	adb_${target} push ${src} ${dest} 2>/dev/null
     28 fi
     29