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 DEFINE_integer ssh_port 22 \ | 13 DEFINE_integer ssh_port 22 \ |
14 "SSH port of the remote machine running Chromium OS instance" | 14 "SSH port of the remote machine running Chromium OS instance" |
15 | 15 |
16 # Copies $1 to $2 on remote host | 16 # Copies $1 to $2 on remote host |
17 function remote_cp_to() { | 17 function remote_cp_to() { |
18 REMOTE_OUT=$(scp -o StrictHostKeyChecking=no -o \ | 18 REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \ |
19 UserKnownHostsFile=$TMP_KNOWN_HOSTS $1 root@$FLAGS_remote:$2) | 19 UserKnownHostsFile=$TMP_KNOWN_HOSTS $1 root@$FLAGS_remote:$2) |
20 return ${PIPESTATUS[0]} | 20 return ${PIPESTATUS[0]} |
21 } | 21 } |
22 | 22 |
23 # Copies a list of remote files specified in file $1 to local location | 23 # Copies a list of remote files specified in file $1 to local location |
24 # $2. Directory paths in $1 are collapsed into $2. | 24 # $2. Directory paths in $1 are collapsed into $2. |
25 function remote_rsync_from() { | 25 function remote_rsync_from() { |
26 rsync -e "ssh -o StrictHostKeyChecking=no -o \ | 26 rsync -e "ssh -o StrictHostKeyChecking=no -o \ |
27 UserKnownHostsFile=$TMP_KNOWN_HOSTS" --no-R \ | 27 UserKnownHostsFile=$TMP_KNOWN_HOSTS" --no-R \ |
28 --files-from=$1 root@${FLAGS_remote}:/ $2 | 28 --files-from=$1 root@${FLAGS_remote}:/ $2 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 function remote_access_init() { | 82 function remote_access_init() { |
83 TMP_PRIVATE_KEY=$TMP/private_key | 83 TMP_PRIVATE_KEY=$TMP/private_key |
84 TMP_KNOWN_HOSTS=$TMP/known_hosts | 84 TMP_KNOWN_HOSTS=$TMP/known_hosts |
85 if [ -z "$FLAGS_remote" ]; then | 85 if [ -z "$FLAGS_remote" ]; then |
86 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" | 86 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" |
87 exit 1 | 87 exit 1 |
88 fi | 88 fi |
89 set_up_remote_access | 89 set_up_remote_access |
90 } | 90 } |
OLD | NEW |