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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 | 574 |
575 # Enforce minimum desktop size, as a sanity-check. The limit of 100 will | 575 # Enforce minimum desktop size, as a sanity-check. The limit of 100 will |
576 # detect typos of 2 instead of 3 digits. | 576 # detect typos of 2 instead of 3 digits. |
577 if width < 100 or height < 100: | 577 if width < 100 or height < 100: |
578 raise ValueError | 578 raise ValueError |
579 except ValueError: | 579 except ValueError: |
580 parser.error("Width and height should be 100 pixels or greater") | 580 parser.error("Width and height should be 100 pixels or greater") |
581 | 581 |
582 atexit.register(cleanup) | 582 atexit.register(cleanup) |
583 | 583 |
584 for s in [signal.SIGHUP, signal.SIGINT, signal.SIGTERM, signal.SIGUSR1]: | 584 if os.name == 'posix': |
585 signal.signal(s, signal_handler) | 585 for s in [signal.SIGHUP, signal.SIGINT, signal.SIGTERM, signal.SIGUSR1]: |
586 signal.signal(s, signal_handler) | |
Wez
2012/03/01 18:03:06
We won't be using this script on Windows & Mac, th
alexeypa (please no reviews)
2012/03/01 20:33:58
I guess so. It was an easy way to get me2me config
Wez
2012/03/01 21:11:36
There is a separate register_host.py script for re
Lambros
2012/03/01 21:15:41
This script is almost entirely Linux-specific. I
| |
586 | 587 |
587 # Ensure full path to config directory exists. | 588 # Ensure full path to config directory exists. |
588 if not os.path.exists(CONFIG_DIR): | 589 if not os.path.exists(CONFIG_DIR): |
589 os.makedirs(CONFIG_DIR, mode=0700) | 590 os.makedirs(CONFIG_DIR, mode=0700) |
590 | 591 |
591 auth = Authentication(os.path.join(CONFIG_DIR, "auth.json")) | 592 auth = Authentication(os.path.join(CONFIG_DIR, "auth.json")) |
592 need_auth_tokens = not auth.load_config() | 593 need_auth_tokens = not auth.load_config() |
593 | 594 |
594 host = Host(os.path.join(CONFIG_DIR, "host#%s.json" % host_hash)) | 595 host = Host(os.path.join(CONFIG_DIR, "host#%s.json" % host_hash)) |
595 register_host = not host.load_config() | 596 register_host = not host.load_config() |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 logging.info("Host ID has been deleted - exiting.") | 734 logging.info("Host ID has been deleted - exiting.") |
734 # Host config is no longer valid. Delete it, so the next time this | 735 # Host config is no longer valid. Delete it, so the next time this |
735 # script is run, a new Host ID will be created and registered. | 736 # script is run, a new Host ID will be created and registered. |
736 os.remove(host.config_file) | 737 os.remove(host.config_file) |
737 return 0 | 738 return 0 |
738 | 739 |
739 | 740 |
740 if __name__ == "__main__": | 741 if __name__ == "__main__": |
741 logging.basicConfig(level=logging.DEBUG) | 742 logging.basicConfig(level=logging.DEBUG) |
742 sys.exit(main()) | 743 sys.exit(main()) |
OLD | NEW |