blob: 0da0fb9f14f0e664b7e8025cd564638ad3ade4c7 [file] [log] [blame]
Shuo-Peng Liaob69ac572020-09-28 17:29:31 +08001#!/bin/bash
2#
3# Provides run_dut and deploy_dut functions.
4
5# The real path of the script resides.
6DEPLOY_PATH=$( realpath $( dirname "${BASH_SOURCE[0]}" ) )
7
8IDENTITY=$DEPLOY_PATH/testing_rsa
9SSH_CONFIG=$DEPLOY_PATH/ssh_config
10
11# Check that identity file exists.
12if [ ! -f $IDENTITY ]; then
13 echo "Please copy testing_rsa to $IDENTITY, which can be found in"
14 echo "https://chromium.googlesource.com/chromiumos/chromite/+/master/ssh_keys#"
15 echo "Remember to run 'chmod 600 $IDENTITY'."
16 exit 1
17fi
18
19# Run command on DUT.
20function run_dut {
21 ssh -i $IDENTITY -F $SSH_CONFIG $DUT_HOST $@
22}
23
Shuo-Peng Liaoafe5b182020-10-27 16:14:39 +080024# Copy source file(s) to $DUT_HOST:${last_param}
25function deploy {
26 scp -i $IDENTITY -F $SSH_CONFIG ${@:1:$#-1} $DUT_HOST:${!#}
Shuo-Peng Liaob69ac572020-09-28 17:29:31 +080027}