| OLD | NEW |
| 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Library for setting up remote access and running remote commands. | 5 # Library for setting up remote access and running remote commands. |
| 6 | 6 |
| 7 DEFAULT_PRIVATE_KEY="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts/\ | 7 DEFAULT_PRIVATE_KEY="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts/\ |
| 8 ssh_keys/testing_rsa" | 8 ssh_keys/testing_rsa" |
| 9 | 9 |
| 10 DEFINE_string remote "" "remote hostname/IP of running Chromium OS instance" | 10 DEFINE_string remote "" "remote hostname/IP of running Chromium OS instance" |
| 11 DEFINE_string private_key "$DEFAULT_PRIVATE_KEY" \ | 11 DEFINE_string private_key "$DEFAULT_PRIVATE_KEY" \ |
| 12 "Private key of root account on remote host" | 12 "Private key of root account on remote host" |
| 13 | 13 |
| 14 # Copies $1 to $2 on remote host |
| 15 function remote_cp() { |
| 16 REMOTE_OUT=$(scp -o StrictHostKeyChecking=no -o \ |
| 17 UserKnownHostsFile=$TMP_KNOWN_HOSTS $1 root@$FLAGS_remote:$2) |
| 18 return ${PIPESTATUS[0]} |
| 19 } |
| 20 |
| 14 function remote_sh() { | 21 function remote_sh() { |
| 15 REMOTE_OUT=$(ssh -o StrictHostKeyChecking=no -o \ | 22 REMOTE_OUT=$(ssh -o StrictHostKeyChecking=no -o \ |
| 16 UserKnownHostsFile=$TMP_KNOWN_HOSTS root@$FLAGS_remote "$@") | 23 UserKnownHostsFile=$TMP_KNOWN_HOSTS root@$FLAGS_remote "$@") |
| 17 return ${PIPESTATUS[0]} | 24 return ${PIPESTATUS[0]} |
| 18 } | 25 } |
| 19 | 26 |
| 20 function remote_sh_allow_changed_host_key() { | 27 function remote_sh_allow_changed_host_key() { |
| 21 rm -f $TMP_KNOWN_HOSTS | 28 rm -f $TMP_KNOWN_HOSTS |
| 22 remote_sh "$@" | 29 remote_sh "$@" |
| 23 } | 30 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 | 59 |
| 53 function remote_access_init() { | 60 function remote_access_init() { |
| 54 TMP_PRIVATE_KEY=$TMP/private_key | 61 TMP_PRIVATE_KEY=$TMP/private_key |
| 55 TMP_KNOWN_HOSTS=$TMP/known_hosts | 62 TMP_KNOWN_HOSTS=$TMP/known_hosts |
| 56 if [ -z "$FLAGS_remote" ]; then | 63 if [ -z "$FLAGS_remote" ]; then |
| 57 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" | 64 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" |
| 58 exit 1 | 65 exit 1 |
| 59 fi | 66 fi |
| 60 set_up_remote_access | 67 set_up_remote_access |
| 61 } | 68 } |
| OLD | NEW |