| #!/bin/bash | |
| # Copyright 2017 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| ### copy a file to a target device | |
| ## usage: fx cp SRC DST | |
| ## Copies a file from the host to the target device. | |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh | |
| if [[ $# -ne 2 ]]; then | |
| fx-command-help | |
| exit 1 | |
| fi | |
| src=$1 | |
| dst=$2 | |
| host="$(fx-command-run netaddr --fuchsia)" | |
| fx-command-run sftp -q -b - "[${host}]" > /dev/null << EOF | |
| - rm ${dst} | |
| put ${src} ${dst} | |
| EOF |