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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 483 |
484 Returns: | 484 Returns: |
485 A string containing the command to run, or a list of strings containing | 485 A string containing the command to run, or a list of strings containing |
486 the executable program and its arguments, which is suitable for passing as | 486 the executable program and its arguments, which is suitable for passing as |
487 the first parameter of subprocess.Popen(). If a suitable session cannot | 487 the first parameter of subprocess.Popen(). If a suitable session cannot |
488 be found, returns None. | 488 be found, returns None. |
489 """ | 489 """ |
490 if XSESSION_COMMAND is not None: | 490 if XSESSION_COMMAND is not None: |
491 return XSESSION_COMMAND | 491 return XSESSION_COMMAND |
492 | 492 |
| 493 # Use a custom startup file if present |
| 494 startup_file = os.path.expanduser("~/.chrome-remote-desktop-session") |
| 495 if os.path.exists(startup_file): |
| 496 # Use the same logic that a Debian system typically uses with ~/.xsession |
| 497 # (see /etc/X11/Xsession.d/50x11-common_determine-startup), to determine |
| 498 # exactly how to run this file. |
| 499 if os.access(startup_file, os.X_OK): |
| 500 return startup_file |
| 501 else: |
| 502 shell = os.environ.get("SHELL", "sh") |
| 503 return [shell, startup_file] |
| 504 |
493 # Unity-2d would normally be the preferred choice on Ubuntu 12.04. At the | 505 # Unity-2d would normally be the preferred choice on Ubuntu 12.04. At the |
494 # time of writing, this session does not work properly (missing launcher and | 506 # time of writing, this session does not work properly (missing launcher and |
495 # panel), so gnome-session-fallback is used in preference. | 507 # panel), so gnome-session-fallback is used in preference. |
496 # "unity-2d-panel" was chosen here simply because it appears in the TryExec | 508 # "unity-2d-panel" was chosen here simply because it appears in the TryExec |
497 # line of the session's .desktop file; other choices might be just as good. | 509 # line of the session's .desktop file; other choices might be just as good. |
498 for test_file, command in [ | 510 for test_file, command in [ |
499 ("/usr/bin/gnome-session-fallback", | 511 ("/usr/bin/gnome-session-fallback", |
500 ["/etc/X11/Xsession", "gnome-session-fallback"]), | 512 ["/etc/X11/Xsession", "gnome-session-fallback"]), |
501 ("/etc/gdm/Xsession", "/etc/gdm/Xsession"), | 513 ("/etc/gdm/Xsession", "/etc/gdm/Xsession"), |
502 ("/usr/bin/unity-2d-panel", | 514 ("/usr/bin/unity-2d-panel", |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 logging.info("OAuth credentials are invalid - exiting.") | 883 logging.info("OAuth credentials are invalid - exiting.") |
872 try: | 884 try: |
873 os.remove(auth.config_file) | 885 os.remove(auth.config_file) |
874 except: | 886 except: |
875 pass | 887 pass |
876 return 0 | 888 return 0 |
877 | 889 |
878 if __name__ == "__main__": | 890 if __name__ == "__main__": |
879 logging.basicConfig(level=logging.DEBUG) | 891 logging.basicConfig(level=logging.DEBUG) |
880 sys.exit(main()) | 892 sys.exit(main()) |
OLD | NEW |