Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1288)

Unified Diff: src/scripts/remote_access.sh

Issue 519041: Simple way to run client/server autotest(s) from server (Closed)
Patch Set: No longer necessary to graft Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scripts/image_to_live.sh ('k') | src/scripts/run_remote_tests.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/remote_access.sh
diff --git a/src/scripts/remote_access.sh b/src/scripts/remote_access.sh
new file mode 100644
index 0000000000000000000000000000000000000000..de44ac45ad73c47e526b167c7748ce760c4c5a1b
--- /dev/null
+++ b/src/scripts/remote_access.sh
@@ -0,0 +1,48 @@
+# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Library for setting up remote access and running remote commands.
+
+DEFAULT_PRIVATE_KEY="$SRC_ROOT/platform/testing/testing_rsa"
+
+DEFINE_string remote "" "remote hostname/IP of running Chromium OS instance"
+DEFINE_string private_key "$DEFAULT_PRIVATE_KEY" \
+ "Private key of root account on remote host"
+
+function remote_sh() {
+ # Disable strict host checking so that we don't prompt the user when
+ # the host key file is removed and just go ahead and add it.
+ REMOTE_OUT=$(ssh -o StrictHostKeyChecking=no -o \
+ UserKnownHostsFile=$TMP_KNOWN_HOSTS root@$FLAGS_remote "$@")
+ return ${PIPESTATUS[0]}
+}
+
+function remote_sh_allow_changed_host_key() {
+ rm -f $TMP_KNOWN_HOSTS
+ remote_sh "$@"
+}
+
+function set_up_remote_access() {
+ if [ -z "$SSH_AGENT_PID" ]; then
+ eval `ssh-agent`
+ fi
+ cp $FLAGS_private_key $TMP_PRIVATE_KEY
+ chmod 0400 $TMP_PRIVATE_KEY
+ ssh-add $TMP_PRIVATE_KEY
+
+ # Verify the client is reachable before continuing
+ echo "Initiating first contact with remote host"
+ remote_sh "true"
+ echo "Connection OK"
+}
+
+function remote_access_init() {
+ TMP_PRIVATE_KEY=$TMP/private_key
+ TMP_KNOWN_HOSTS=$TMP/known_hosts
+ if [ -z "$FLAGS_remote" ]; then
+ echo "Please specify --remote=<IP-or-hostname> of the Chromium OS instance"
+ exit 1
+ fi
+ set_up_remote_access
+}
« no previous file with comments | « src/scripts/image_to_live.sh ('k') | src/scripts/run_remote_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698