lin
2025-08-01 633231e833e21d5b8b1c00cb15aedb62b3b78e8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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 ${target} "tar -C ${dest} -zxf -"
else
   scp -q ${src} ${target}:${dest}
fi