OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # Virtual Me2Me implementation. This script runs and manages the processes | 6 # Virtual Me2Me implementation. This script runs and manages the processes |
7 # required for a Virtual Me2Me desktop, which are: X server, X desktop | 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop |
8 # session, and Host process. | 8 # session, and Host process. |
9 # This script is intended to run continuously as a background daemon | 9 # This script is intended to run continuously as a background daemon |
10 # process, running under an ordinary (non-root) user account. | 10 # process, running under an ordinary (non-root) user account. |
(...skipping 12 matching lines...) Expand all Loading... |
23 import signal | 23 import signal |
24 import socket | 24 import socket |
25 import subprocess | 25 import subprocess |
26 import sys | 26 import sys |
27 import tempfile | 27 import tempfile |
28 import time | 28 import time |
29 import urllib2 | 29 import urllib2 |
30 import uuid | 30 import uuid |
31 | 31 |
32 # Local modules | 32 # Local modules |
| 33 sys.path.insert(0, "/usr/share/chrome-remote-desktop") |
33 import gaia_auth | 34 import gaia_auth |
34 import keygen | 35 import keygen |
35 | 36 |
36 # By default this script will try to determine the most appropriate X session | 37 # By default this script will try to determine the most appropriate X session |
37 # command for the system. To use a specific session instead, set this variable | 38 # command for the system. To use a specific session instead, set this variable |
38 # to the executable filename, or a list containing the executable and any | 39 # to the executable filename, or a list containing the executable and any |
39 # arguments, for example: | 40 # arguments, for example: |
40 # XSESSION_COMMAND = "/usr/bin/gnome-session-fallback" | 41 # XSESSION_COMMAND = "/usr/bin/gnome-session-fallback" |
41 # XSESSION_COMMAND = ["/usr/bin/gnome-session", "--session=ubuntu-2d"] | 42 # XSESSION_COMMAND = ["/usr/bin/gnome-session", "--session=ubuntu-2d"] |
42 XSESSION_COMMAND = None | 43 XSESSION_COMMAND = None |
43 | 44 |
44 REMOTING_COMMAND = "remoting_me2me_host" | 45 REMOTING_COMMAND = "remoting_me2me_host" |
45 | 46 |
46 # Command-line switch for passing the config path to remoting_me2me_host. | 47 # Command-line switch for passing the config path to remoting_me2me_host. |
47 HOST_CONFIG_SWITCH_NAME = "host-config" | 48 HOST_CONFIG_SWITCH_NAME = "host-config" |
48 | 49 |
49 # Needs to be an absolute path, since the current working directory is changed | 50 # Needs to be an absolute path, since the current working directory is changed |
50 # when this process self-daemonizes. | 51 # when this process self-daemonizes. |
51 SCRIPT_PATH = os.path.dirname(sys.argv[0]) | 52 SCRIPT_PATH = os.path.dirname(sys.argv[0]) |
52 if SCRIPT_PATH: | 53 if SCRIPT_PATH: |
53 SCRIPT_PATH = os.path.abspath(SCRIPT_PATH) | 54 SCRIPT_PATH = os.path.abspath(SCRIPT_PATH) |
54 else: | 55 else: |
55 SCRIPT_PATH = os.getcwd() | 56 SCRIPT_PATH = os.getcwd() |
56 | 57 |
57 # These are relative to SCRIPT_PATH. | 58 # These are relative to SCRIPT_PATH. |
58 EXE_PATHS_TO_TRY = [ | 59 EXE_PATHS_TO_TRY = [ |
59 ".", | 60 ".", |
60 "../../out/Debug", | 61 "../../out/Debug", |
61 "../../out/Release" | 62 "../../out/Release", |
| 63 "/usr/lib/chrome-remote-desktop", |
62 ] | 64 ] |
63 | 65 |
64 CONFIG_DIR = os.path.expanduser("~/.config/chrome-remote-desktop") | 66 CONFIG_DIR = os.path.expanduser("~/.config/chrome-remote-desktop") |
65 HOME_DIR = os.environ["HOME"] | 67 HOME_DIR = os.environ["HOME"] |
66 | 68 |
67 X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock" | 69 X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock" |
68 FIRST_X_DISPLAY_NUMBER = 20 | 70 FIRST_X_DISPLAY_NUMBER = 20 |
69 | 71 |
70 X_AUTH_FILE = os.path.expanduser("~/.Xauthority") | 72 X_AUTH_FILE = os.path.expanduser("~/.Xauthority") |
71 os.environ["XAUTHORITY"] = X_AUTH_FILE | 73 os.environ["XAUTHORITY"] = X_AUTH_FILE |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 os.remove(host.config_file) | 847 os.remove(host.config_file) |
846 return 0 | 848 return 0 |
847 elif os.WEXITSTATUS(status) == 4: | 849 elif os.WEXITSTATUS(status) == 4: |
848 logging.info("OAuth credentials are invalid - exiting.") | 850 logging.info("OAuth credentials are invalid - exiting.") |
849 os.remove(auth.config_file) | 851 os.remove(auth.config_file) |
850 return 0 | 852 return 0 |
851 | 853 |
852 if __name__ == "__main__": | 854 if __name__ == "__main__": |
853 logging.basicConfig(level=logging.DEBUG) | 855 logging.basicConfig(level=logging.DEBUG) |
854 sys.exit(main()) | 856 sys.exit(main()) |
OLD | NEW |