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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 | 480 |
481 Returns: | 481 Returns: |
482 A string containing the command to run, or a list of strings containing | 482 A string containing the command to run, or a list of strings containing |
483 the executable program and its arguments, which is suitable for passing as | 483 the executable program and its arguments, which is suitable for passing as |
484 the first parameter of subprocess.Popen(). If a suitable session cannot | 484 the first parameter of subprocess.Popen(). If a suitable session cannot |
485 be found, returns None. | 485 be found, returns None. |
486 """ | 486 """ |
487 if XSESSION_COMMAND is not None: | 487 if XSESSION_COMMAND is not None: |
488 return XSESSION_COMMAND | 488 return XSESSION_COMMAND |
489 | 489 |
490 # Use a custom startup file if present | |
491 startup_file = os.path.expanduser("~/.me2me_session") | |
Sergey Ulanov
2012/07/31 21:09:41
maybe call it .crd_session or .chrome_remoting_ses
Lambros
2012/08/01 23:46:17
I've changed it to ~/.chrome-remote-desktop-sessio
| |
492 if os.path.exists(startup_file): | |
493 # Use the same logic that a Debian system typically uses with ~/.xsession | |
494 # (see /etc/X11/Xsession.d/50x11-common_determine-startup), to determine | |
495 # exactly how to run this file. | |
496 if os.access(startup_file, os.X_OK): | |
497 return startup_file | |
498 else: | |
499 shell = os.environ.get("SHELL", "sh") | |
Jamie
2012/07/31 21:08:06
Optional: test for undefined SHELL variable?
| |
500 return [shell, startup_file] | |
501 | |
490 # Unity-2d would normally be the preferred choice on Ubuntu 12.04. At the | 502 # Unity-2d would normally be the preferred choice on Ubuntu 12.04. At the |
491 # time of writing, this session does not work properly (missing launcher and | 503 # time of writing, this session does not work properly (missing launcher and |
492 # panel), so gnome-session-fallback is used in preference. | 504 # panel), so gnome-session-fallback is used in preference. |
493 # "unity-2d-panel" was chosen here simply because it appears in the TryExec | 505 # "unity-2d-panel" was chosen here simply because it appears in the TryExec |
494 # line of the session's .desktop file; other choices might be just as good. | 506 # line of the session's .desktop file; other choices might be just as good. |
495 for test_file, command in [ | 507 for test_file, command in [ |
496 ("/usr/bin/gnome-session-fallback", "/usr/bin/gnome-session-fallback"), | 508 ("/usr/bin/gnome-session-fallback", "/usr/bin/gnome-session-fallback"), |
497 ("/etc/gdm/Xsession", "/etc/gdm/Xsession"), | 509 ("/etc/gdm/Xsession", "/etc/gdm/Xsession"), |
498 ("/usr/bin/unity-2d-panel", | 510 ("/usr/bin/unity-2d-panel", |
499 ["/usr/bin/gnome-session", "--session=ubuntu-2d"]), | 511 ["/usr/bin/gnome-session", "--session=ubuntu-2d"]), |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 os.remove(host.config_file) | 859 os.remove(host.config_file) |
848 return 0 | 860 return 0 |
849 elif os.WEXITSTATUS(status) == 4: | 861 elif os.WEXITSTATUS(status) == 4: |
850 logging.info("OAuth credentials are invalid - exiting.") | 862 logging.info("OAuth credentials are invalid - exiting.") |
851 os.remove(auth.config_file) | 863 os.remove(auth.config_file) |
852 return 0 | 864 return 0 |
853 | 865 |
854 if __name__ == "__main__": | 866 if __name__ == "__main__": |
855 logging.basicConfig(level=logging.DEBUG) | 867 logging.basicConfig(level=logging.DEBUG) |
856 sys.exit(main()) | 868 sys.exit(main()) |
OLD | NEW |