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 | |
Lambros
2012/09/13 22:00:35
typo: Xvfb-randr
Jamie
2012/09/14 21:07:34
Done.
| |
258 # a Xvfb-randr package that installs somewhere sensible. | |
259 xvfb = "/usr/bin/Xvfb-randr" | |
Sergey Ulanov
2012/09/13 20:52:43
Not directly related to this CL: maybe we can just
Jamie
2012/09/14 21:07:34
Lambros had some reason for preferring to keep the
| |
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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 | 606 |
602 | 607 |
603 def main(): | 608 def main(): |
604 DEFAULT_SIZE = "1280x800" | 609 DEFAULT_SIZE = "1280x800" |
605 EPILOG = """This script is not intended for use by end-users. To configure | 610 EPILOG = """This script is not intended for use by end-users. To configure |
606 Chrome Remote Desktop, please install the app from the Chrome | 611 Chrome Remote Desktop, please install the app from the Chrome |
607 Web Store: https://chrome.google.com/remotedesktop""" | 612 Web Store: https://chrome.google.com/remotedesktop""" |
608 parser = optparse.OptionParser( | 613 parser = optparse.OptionParser( |
609 usage="Usage: %prog [options] [ -- [ X server options ] ]", | 614 usage="Usage: %prog [options] [ -- [ X server options ] ]", |
610 epilog=EPILOG) | 615 epilog=EPILOG) |
611 parser.add_option("-s", "--size", dest="size", action="append", | 616 parser.add_option("-s", "--size", dest="size", action="append", |
rmsousa
2012/09/13 21:59:05
TODO: For this feature to be fully functional we n
Jamie
2012/09/14 21:07:34
I forgot to increase the default maximum size. You
| |
612 help="Dimensions of virtual desktop (default: %s). " | 617 help="Dimensions of virtual desktop (default: %s). " |
613 "This can be specified multiple times to make multiple " | 618 "This can be specified multiple times to make multiple " |
614 "screen resolutions available (if the Xvfb server " | 619 "screen resolutions available (if the Xvfb server " |
615 "supports this)" % DEFAULT_SIZE) | 620 "supports this)" % DEFAULT_SIZE) |
616 parser.add_option("-f", "--foreground", dest="foreground", default=False, | 621 parser.add_option("-f", "--foreground", dest="foreground", default=False, |
617 action="store_true", | 622 action="store_true", |
618 help="Don't run as a background daemon.") | 623 help="Don't run as a background daemon.") |
619 parser.add_option("", "--start", dest="start", default=False, | 624 parser.add_option("", "--start", dest="start", default=False, |
620 action="store_true", | 625 action="store_true", |
621 help="Start the host.") | 626 help="Start the host.") |
(...skipping 225 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 |