summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 15:38:29 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 15:38:29 +0000
commit7de8b1873902cb8857a27ae6b0b6d5b5291d62b0 (patch)
tree78c19a6307e0bee6eb8a2cda8fc99b6bcc373072 /remoting/tools
parente5366896e9ccb3dd17c590d115bd999e987a33af (diff)
downloadchromium_src-7de8b1873902cb8857a27ae6b0b6d5b5291d62b0.zip
chromium_src-7de8b1873902cb8857a27ae6b0b6d5b5291d62b0.tar.gz
chromium_src-7de8b1873902cb8857a27ae6b0b6d5b5291d62b0.tar.bz2
Get scripts working independent of where they are run.
Also store script data in home directory. TEST=none BUG=none Review URL: http://codereview.chromium.org/2832019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-xremoting/tools/gettoken.py6
-rwxr-xr-xremoting/tools/register_host.py6
-rwxr-xr-xremoting/tools/runclient.py20
3 files changed, 22 insertions, 10 deletions
diff --git a/remoting/tools/gettoken.py b/remoting/tools/gettoken.py
index 3a61927..a4024d7 100755
--- a/remoting/tools/gettoken.py
+++ b/remoting/tools/gettoken.py
@@ -13,7 +13,7 @@ import urllib
import gaia_auth
-auth_filename = '.chromotingAuthToken'
+auth_filepath = os.path.join(os.getenv('HOME'), '.chromotingAuthToken')
print "Email:",
email = raw_input()
@@ -25,7 +25,7 @@ auth_token = authenticator.authenticate(email, passwd)
# Set permission mask for created file.
os.umask(0066)
-auth_file = open(auth_filename, 'w')
+auth_file = open(auth_filepath, 'w')
auth_file.write(email)
auth_file.write('\n')
auth_file.write(auth_token)
@@ -35,4 +35,4 @@ print
print 'Auth token:'
print
print auth_token
-print '...saved in', auth_filename
+print '...saved in', auth_filepath
diff --git a/remoting/tools/register_host.py b/remoting/tools/register_host.py
index bb9f473..11e5e4c 100755
--- a/remoting/tools/register_host.py
+++ b/remoting/tools/register_host.py
@@ -19,7 +19,7 @@ import gaia_auth
server = 'www-googleapis-test.sandbox.google.com'
url = 'http://' + server + '/chromoting/v1/@me/hosts'
-settings_filename = 'ChromotingConfig.json'
+settings_filepath = os.path.join(os.getenv('HOME'), '.ChromotingConfig.json')
print "Email:",
email = raw_input()
@@ -70,7 +70,7 @@ auth_token = authenticator.authenticate(email, password)
# Write settings file.
os.umask(0066) # Set permission mask for created file.
-settings_file = open(settings_filename, 'w')
+settings_file = open(settings_filepath, 'w')
settings_file.write('{\n');
settings_file.write(' "xmpp_login" : "' + email + '",\n')
settings_file.write(' "xmpp_auth_token" : "' + auth_token + '",\n')
@@ -80,4 +80,4 @@ settings_file.write(' "public_key" : "' + public_key + '"\n')
settings_file.write('}\n')
settings_file.close()
-print 'Configuration saved in', settings_filename
+print 'Configuration saved in', settings_filepath
diff --git a/remoting/tools/runclient.py b/remoting/tools/runclient.py
index 62db605..000b70e 100755
--- a/remoting/tools/runclient.py
+++ b/remoting/tools/runclient.py
@@ -9,11 +9,24 @@
# so that the host authentication arguments can be automatically set.
import os
+import platform
-auth_filename = '.chromotingAuthToken'
+auth_filepath = os.path.join(os.getenv('HOME'), '.chromotingAuthToken')
+script_path = os.path.dirname(__file__)
+
+if platform.system() == "Windows":
+ # TODO(garykac): Make this work on Windows.
+ print 'Not yet supported on Windows.'
+ exit(1)
+elif platform.system() == "Darwin": # Darwin == MacOSX
+ client_path = '../../xcodebuild/Debug/chromoting_simple_client'
+else:
+ client_path = '../../out/Debug/chromoting_x11_client'
+
+client_path = os.path.join(script_path, client_path)
# Read username and auth token from token file.
-auth = open(auth_filename)
+auth = open(auth_filepath)
authinfo = auth.readlines()
username = authinfo[0].rstrip()
@@ -26,9 +39,8 @@ print 'Host JID:', username + '/chromoting',
hostjid_suffix = raw_input()
hostjid = username + '/chromoting' + hostjid_suffix
-# TODO(garykac): Make this work on Windows.
command = []
-command.append('../../out/Debug/chromoting_x11_client')
+command.append(client_path)
command.append('--host_jid ' + hostjid)
command.append('--jid ' + username)
command.append('--token ' + authtoken)