OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # URL from which the latest version of this script can be downloaded. | 6 # URL from which the latest version of this script can be downloaded. |
7 script_url="http://src.chromium.org/svn/trunk/src/tools/android/adb_remote_setup
.sh" | 7 script_url="http://src.chromium.org/svn/trunk/src/tools/android/adb_remote_setup
.sh" |
8 | 8 |
9 # Replaces this file with the latest version of the script and runs it. | 9 # Replaces this file with the latest version of the script and runs it. |
10 update-self() { | 10 update-self() { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if ! which adb >/dev/null; then | 54 if ! which adb >/dev/null; then |
55 echo "error: adb must be in your local machine's path." | 55 echo "error: adb must be in your local machine's path." |
56 exit 1 | 56 exit 1 |
57 fi | 57 fi |
58 | 58 |
59 if which kinit >/dev/null; then | 59 if which kinit >/dev/null; then |
60 # Allow ssh to succeed without typing your password multiple times. | 60 # Allow ssh to succeed without typing your password multiple times. |
61 kinit -R || kinit | 61 kinit -R || kinit |
62 fi | 62 fi |
63 | 63 |
| 64 # Ensure local and remote versions of adb are the same. |
| 65 remote_adb_version=$(ssh "$remote_host" "$remote_adb version") |
| 66 local_adb_version=$(adb version) |
| 67 if [[ "$local_adb_version" != "$remote_adb_version" ]]; then |
| 68 echo >&2 |
| 69 echo "WARNING: local adb is not the same version as remote adb." >&2 |
| 70 echo "This should be fixed since it may result in protocol errors." >&2 |
| 71 echo " local adb: $local_adb_version" >&2 |
| 72 echo " remote adb: $remote_adb_version" >&2 |
| 73 echo >&2 |
| 74 sleep 5 |
| 75 fi |
| 76 |
64 # Kill the adb server on the remote host. | 77 # Kill the adb server on the remote host. |
65 ssh "$remote_host" "$remote_adb kill-server" | 78 ssh "$remote_host" "$remote_adb kill-server" |
66 | 79 |
67 # Start the adb server locally. | 80 # Start the adb server locally. |
68 adb start-server | 81 adb start-server |
69 | 82 |
70 # Forward various ports from the remote host to the local host: | 83 # Forward various ports from the remote host to the local host: |
71 # 5037: adb | 84 # 5037: adb |
72 # 8001: http server | 85 # 8001: http server |
73 # 9031: sync server | 86 # 9031: sync server |
74 # 10000: net unittests | 87 # 10000: net unittests |
75 # 10201: net unittests | 88 # 10201: net unittests |
76 ssh -C \ | 89 ssh -C \ |
77 -R 5037:localhost:5037 \ | 90 -R 5037:localhost:5037 \ |
78 -L 8001:localhost:8001 \ | 91 -L 8001:localhost:8001 \ |
79 -L 9031:localhost:9031 \ | 92 -L 9031:localhost:9031 \ |
80 -R 10000:localhost:10000 \ | 93 -R 10000:localhost:10000 \ |
81 -R 10201:localhost:10201 \ | 94 -R 10201:localhost:10201 \ |
82 "$remote_host" | 95 "$remote_host" |
OLD | NEW |