Shuo-Peng Liao | b69ac57 | 2020-09-28 17:29:31 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Provides run_dut and deploy_dut functions. |
| 4 | |
| 5 | # The real path of the script resides. |
| 6 | DEPLOY_PATH=$( realpath $( dirname "${BASH_SOURCE[0]}" ) ) |
| 7 | |
| 8 | IDENTITY=$DEPLOY_PATH/testing_rsa |
| 9 | SSH_CONFIG=$DEPLOY_PATH/ssh_config |
| 10 | |
| 11 | # Check that identity file exists. |
| 12 | if [ ! -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 |
| 17 | fi |
| 18 | |
| 19 | # Run command on DUT. |
| 20 | function run_dut { |
| 21 | ssh -i $IDENTITY -F $SSH_CONFIG $DUT_HOST $@ |
| 22 | } |
| 23 | |
Shuo-Peng Liao | afe5b18 | 2020-10-27 16:14:39 +0800 | [diff] [blame] | 24 | # Copy source file(s) to $DUT_HOST:${last_param} |
| 25 | function deploy { |
| 26 | scp -i $IDENTITY -F $SSH_CONFIG ${@:1:$#-1} $DUT_HOST:${!#} |
Shuo-Peng Liao | b69ac57 | 2020-09-28 17:29:31 +0800 | [diff] [blame] | 27 | } |