29 lines
		
	
	
		
			609 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			609 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
| #!/bin/bash
 | |
| set -e -o pipefail
 | |
| 
 | |
| # Copy a file or directory to the target ChromeOS device.
 | |
| #
 | |
| # Usage: target_cp <src> <target>:<dest>
 | |
| 
 | |
| src="$1"
 | |
| shift
 | |
| 
 | |
| targetdest="$1"
 | |
| shift
 | |
| 
 | |
| target="${targetdest%:*}"
 | |
| dest="${targetdest#*:}"
 | |
| 
 | |
| if [[ -z "${src}" || -z "${target}" || -z "${dest}" || "${targetdest}" != "${target}:${dest}" || -n "$*" ]]
 | |
| then
 | |
| 	echo "Usage: target_cp <src> <target>:<dest>"
 | |
| 	exit 1
 | |
| fi
 | |
| 
 | |
| if [[ -d ${src} ]]
 | |
| then
 | |
| 	tar -C $(dirname ${src}) -zcf - $(basename ${src}) | ssh -i ${HOME}/.ssh/testing_rsa ${target} "tar -C ${dest} -zxf -"
 | |
| else
 | |
| 	scp -i ${HOME}/.ssh/testing_rsa -q ${src} ${target}:${dest}
 | |
| fi
 |