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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 display = self.get_unused_display_number() | 246 display = self.get_unused_display_number() |
247 ret_code = subprocess.call("xauth add :%d . `mcookie`" % display, | 247 ret_code = subprocess.call("xauth add :%d . `mcookie`" % display, |
248 shell=True) | 248 shell=True) |
249 if ret_code != 0: | 249 if ret_code != 0: |
250 raise Exception("xauth failed with code %d" % ret_code) | 250 raise Exception("xauth failed with code %d" % ret_code) |
251 | 251 |
252 max_width = max([width for width, height in self.sizes]) | 252 max_width = max([width for width, height in self.sizes]) |
253 max_height = max([height for width, height in self.sizes]) | 253 max_height = max([height for width, height in self.sizes]) |
254 | 254 |
255 try: | 255 try: |
256 xvfb = locate_executable("Xvfb-randr") | 256 # TODO(jamiewalch): This script expects to be installed alongside |
| 257 # Xvf-randr, but that's no longer the case. Fix this once we have |
| 258 # a Xvfb-randr package that installs somewhere sensible. |
| 259 xvfb = "/usr/bin/Xvfb-randr" |
| 260 if not os.path.exists(xvfb): |
| 261 xvfb = locate_executable("Xvfb-randr") |
257 except Exception: | 262 except Exception: |
258 xvfb = "Xvfb" | 263 xvfb = "Xvfb" |
259 | 264 |
260 logging.info("Starting %s on display :%d" % (xvfb, display)) | 265 logging.info("Starting %s on display :%d" % (xvfb, display)) |
261 screen_option = "%dx%dx24" % (max_width, max_height) | 266 screen_option = "%dx%dx24" % (max_width, max_height) |
262 self.x_proc = subprocess.Popen([xvfb, ":%d" % display, | 267 self.x_proc = subprocess.Popen([xvfb, ":%d" % display, |
263 "-noreset", | 268 "-noreset", |
264 "-auth", X_AUTH_FILE, | 269 "-auth", X_AUTH_FILE, |
265 "-nolisten", "tcp", | 270 "-nolisten", "tcp", |
266 "-screen", "0", screen_option | 271 "-screen", "0", screen_option |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 return 0 | 852 return 0 |
848 elif os.WEXITSTATUS(status) == 5: | 853 elif os.WEXITSTATUS(status) == 5: |
849 logging.info("Host domain is blocked by policy - exiting.") | 854 logging.info("Host domain is blocked by policy - exiting.") |
850 os.remove(host.config_file) | 855 os.remove(host.config_file) |
851 return 0 | 856 return 0 |
852 # Nothing to do for Mac-only status 6 (login screen unsupported) | 857 # Nothing to do for Mac-only status 6 (login screen unsupported) |
853 | 858 |
854 if __name__ == "__main__": | 859 if __name__ == "__main__": |
855 logging.basicConfig(level=logging.DEBUG) | 860 logging.basicConfig(level=logging.DEBUG) |
856 sys.exit(main()) | 861 sys.exit(main()) |
OLD | NEW |