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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 [ -n "${FLAGS_board}" ] && return | 61 [ -n "${FLAGS_board}" ] && return |
62 remote_sh grep CHROMEOS_RELEASE_BOARD /etc/lsb-release | 62 remote_sh grep CHROMEOS_RELEASE_BOARD /etc/lsb-release |
63 FLAGS_board=$(echo "${REMOTE_OUT}" | cut -d '=' -f 2) | 63 FLAGS_board=$(echo "${REMOTE_OUT}" | cut -d '=' -f 2) |
64 if [ -z "${FLAGS_board}" ]; then | 64 if [ -z "${FLAGS_board}" ]; then |
65 error "Board required" | 65 error "Board required" |
66 exit 1 | 66 exit 1 |
67 fi | 67 fi |
68 info "Target reports board is ${FLAGS_board}" | 68 info "Target reports board is ${FLAGS_board}" |
69 } | 69 } |
70 | 70 |
| 71 function learn_arch() { |
| 72 [ -n "${FLAGS_arch}" ] && return |
| 73 remote_sh uname -m |
| 74 FLAGS_arch=$(echo "${REMOTE_OUT}" | sed s/armv7l/arm/g) |
| 75 if [ -z "${FLAGS_arch}" ]; then |
| 76 error "Arch required" |
| 77 exit 1 |
| 78 fi |
| 79 info "Target reports arch is ${FLAGS_arch}" |
| 80 } |
| 81 |
71 function remote_reboot { | 82 function remote_reboot { |
72 info "Rebooting." | 83 info "Rebooting." |
73 remote_sh "touch /tmp/awaiting_reboot; reboot" | 84 remote_sh "touch /tmp/awaiting_reboot; reboot" |
74 local output_file | 85 local output_file |
75 output_file="${TMP}/output" | 86 output_file="${TMP}/output" |
76 | 87 |
77 while true; do | 88 while true; do |
78 REMOTE_OUT="" | 89 REMOTE_OUT="" |
79 # This may fail while the machine is down so generate output and a | 90 # This may fail while the machine is down so generate output and a |
80 # boolean result to distinguish between down/timeout and real failure | 91 # boolean result to distinguish between down/timeout and real failure |
(...skipping 25 matching lines...) Expand all Loading... |
106 | 117 |
107 function remote_access_init() { | 118 function remote_access_init() { |
108 TMP_PRIVATE_KEY=$TMP/private_key | 119 TMP_PRIVATE_KEY=$TMP/private_key |
109 TMP_KNOWN_HOSTS=$TMP/known_hosts | 120 TMP_KNOWN_HOSTS=$TMP/known_hosts |
110 if [ -z "$FLAGS_remote" ]; then | 121 if [ -z "$FLAGS_remote" ]; then |
111 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" | 122 echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance" |
112 exit 1 | 123 exit 1 |
113 fi | 124 fi |
114 set_up_remote_access | 125 set_up_remote_access |
115 } | 126 } |
OLD | NEW |