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" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 local timeout=$2 | 76 local timeout=$2 |
77 local -r TIMEOUT_INC=1 | 77 local -r TIMEOUT_INC=1 |
78 local current_timeout=0 | 78 local current_timeout=0 |
79 while is_pid_running ${pid} && [ ${current_timeout} -lt ${timeout} ]; do | 79 while is_pid_running ${pid} && [ ${current_timeout} -lt ${timeout} ]; do |
80 sleep ${TIMEOUT_INC} | 80 sleep ${TIMEOUT_INC} |
81 current_timeout=$((current_timeout + TIMEOUT_INC)) | 81 current_timeout=$((current_timeout + TIMEOUT_INC)) |
82 done | 82 done |
83 ! is_pid_running ${pid} | 83 ! is_pid_running ${pid} |
84 } | 84 } |
85 | 85 |
| 86 function learn_arch() { |
| 87 [ -n "${FLAGS_arch}" ] && return |
| 88 remote_sh uname -m |
| 89 FLAGS_arch=$(echo "${REMOTE_OUT}" | sed s/armv7l/arm/g) |
| 90 if [ -z "${FLAGS_arch}" ]; then |
| 91 error "Arch required" |
| 92 exit 1 |
| 93 fi |
| 94 info "Target reports arch is ${FLAGS_arch}" |
| 95 } |
| 96 |
86 # Checks to see if a machine has rebooted using the presence of a tmp file. | 97 # Checks to see if a machine has rebooted using the presence of a tmp file. |
87 function check_if_rebooted() { | 98 function check_if_rebooted() { |
88 local output_file="${TMP}/output" | 99 local output_file="${TMP}/output" |
89 while true; do | 100 while true; do |
90 REMOTE_OUT="" | 101 REMOTE_OUT="" |
91 # This may fail while the machine is down so generate output and a | 102 # This may fail while the machine is down so generate output and a |
92 # boolean result to distinguish between down/timeout and real failure | 103 # boolean result to distinguish between down/timeout and real failure |
93 ! remote_sh_allow_changed_host_key \ | 104 ! remote_sh_allow_changed_host_key \ |
94 "echo 0; [ -e /tmp/awaiting_reboot ] && echo '1'; true" | 105 "echo 0; [ -e /tmp/awaiting_reboot ] && echo '1'; true" |
95 echo "${REMOTE_OUT}" > "${output_file}" | 106 echo "${REMOTE_OUT}" > "${output_file}" |
(...skipping 28 matching lines...) Expand all Loading... |
124 | 135 |
125 function remote_access_init() { | 136 function remote_access_init() { |
126 TMP_PRIVATE_KEY=$TMP/private_key | 137 TMP_PRIVATE_KEY=$TMP/private_key |
127 TMP_KNOWN_HOSTS=$TMP/known_hosts | 138 TMP_KNOWN_HOSTS=$TMP/known_hosts |
128 if [ -z "$FLAGS_remote" ]; then | 139 if [ -z "$FLAGS_remote" ]; then |
129 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" | 140 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" |
130 exit 1 | 141 exit 1 |
131 fi | 142 fi |
132 set_up_remote_access | 143 set_up_remote_access |
133 } | 144 } |
OLD | NEW |