• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2set -e -o pipefail
3
4# Copy a file or directory to the target ChromeOS device.
5#
6# Usage: target_cp <src> <target>:<dest>
7
8src="$1"
9shift
10
11targetdest="$1"
12shift
13
14target="${targetdest%:*}"
15dest="${targetdest#*:}"
16
17if [[ -z "${src}" || -z "${target}" || -z "${dest}" || "${targetdest}" != "${target}:${dest}" || -n "$*" ]]
18then
19	echo "Usage: target_cp <src> <target>:<dest>"
20	exit 1
21fi
22
23if [[ -d ${src} ]]
24then
25	tar -C $(dirname ${src}) -zcf - $(basename ${src}) | ssh -i ${HOME}/.ssh/testing_rsa ${target} "tar -C ${dest} -zxf -"
26else
27	scp -i ${HOME}/.ssh/testing_rsa -q ${src} ${target}:${dest}
28fi
29