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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 834 |
835 if desktop.session_proc is not None and pid == desktop.session_proc.pid: | 835 if desktop.session_proc is not None and pid == desktop.session_proc.pid: |
836 logging.info("Session process terminated") | 836 logging.info("Session process terminated") |
837 desktop.session_proc = None | 837 desktop.session_proc = None |
838 | 838 |
839 if desktop.host_proc is not None and pid == desktop.host_proc.pid: | 839 if desktop.host_proc is not None and pid == desktop.host_proc.pid: |
840 logging.info("Host process terminated") | 840 logging.info("Host process terminated") |
841 desktop.host_proc = None | 841 desktop.host_proc = None |
842 | 842 |
843 # These exit-codes must match the ones used by the host. | 843 # These exit-codes must match the ones used by the host. |
844 # See remoting/host/host_error_codes.h. | 844 # See remoting/host/constants.h. |
845 # Delete the host or auth configuration depending on the returned error | 845 # Delete the host or auth configuration depending on the returned error |
846 # code, so the next time this script is run, a new configuration | 846 # code, so the next time this script is run, a new configuration |
847 # will be created and registered. | 847 # will be created and registered. |
848 if os.WEXITSTATUS(status) == 2: | 848 if os.WEXITSTATUS(status) == 2: |
849 logging.info("Host configuration is invalid - exiting.") | 849 logging.info("Host configuration is invalid - exiting.") |
850 host_config.clear_auth() | 850 host_config.clear_auth() |
851 host_config.clear_host_info() | 851 host_config.clear_host_info() |
852 host_config.save() | 852 host_config.save() |
853 return 0 | 853 return 0 |
854 elif os.WEXITSTATUS(status) == 3: | 854 elif os.WEXITSTATUS(status) == 3: |
855 logging.info("Host ID has been deleted - exiting.") | 855 logging.info("Host ID has been deleted - exiting.") |
856 host_config.clear_host_info() | 856 host_config.clear_host_info() |
857 host_config.save() | 857 host_config.save() |
858 return 0 | 858 return 0 |
859 elif os.WEXITSTATUS(status) == 4: | 859 elif os.WEXITSTATUS(status) == 4: |
860 logging.info("OAuth credentials are invalid - exiting.") | 860 logging.info("OAuth credentials are invalid - exiting.") |
861 host_config.clear_auth() | 861 host_config.clear_auth() |
862 host_config.save() | 862 host_config.save() |
863 return 0 | 863 return 0 |
864 elif os.WEXITSTATUS(status) == 5: | 864 elif os.WEXITSTATUS(status) == 5: |
865 logging.info("Host domain is blocked by policy - exiting.") | 865 logging.info("Host domain is blocked by policy - exiting.") |
866 os.remove(host.config_file) | 866 os.remove(host.config_file) |
867 return 0 | 867 return 0 |
868 # Nothing to do for Mac-only status 6 (login screen unsupported) | 868 # Nothing to do for Mac-only status 6 (login screen unsupported) |
869 | 869 |
870 if __name__ == "__main__": | 870 if __name__ == "__main__": |
871 logging.basicConfig(level=logging.DEBUG) | 871 logging.basicConfig(level=logging.DEBUG) |
872 sys.exit(main()) | 872 sys.exit(main()) |
OLD | NEW |