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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 self.session_proc = subprocess.Popen(XSESSION_COMMAND, | 376 self.session_proc = subprocess.Popen(XSESSION_COMMAND, |
377 stdin=open(os.devnull, "r"), | 377 stdin=open(os.devnull, "r"), |
378 cwd=HOME_DIR, | 378 cwd=HOME_DIR, |
379 env=self.child_env) | 379 env=self.child_env) |
380 if not self.session_proc.pid: | 380 if not self.session_proc.pid: |
381 raise Exception("Could not start X session") | 381 raise Exception("Could not start X session") |
382 | 382 |
383 def launch_host(self, host): | 383 def launch_host(self, host): |
384 # Start remoting host | 384 # Start remoting host |
385 args = [locate_executable(REMOTING_COMMAND), | 385 args = [locate_executable(REMOTING_COMMAND), |
386 "--host_config=%s" % (host.config_file)] | 386 "--host-config=%s" % (host.config_file)] |
387 if host.auth.config_file != host.config_file: | 387 if host.auth.config_file != host.config_file: |
388 args.append("--auth_config=%s" % (host.auth.config_file)) | 388 args.append("--auth-config=%s" % (host.auth.config_file)) |
389 self.host_proc = subprocess.Popen(args, env=self.child_env) | 389 self.host_proc = subprocess.Popen(args, env=self.child_env) |
390 logging.info(args) | 390 logging.info(args) |
391 if not self.host_proc.pid: | 391 if not self.host_proc.pid: |
392 raise Exception("Could not start remoting host") | 392 raise Exception("Could not start remoting host") |
393 | 393 |
394 | 394 |
395 class PidFile: | 395 class PidFile: |
396 """Class to allow creating and deleting a file which holds the PID of the | 396 """Class to allow creating and deleting a file which holds the PID of the |
397 running process. This is used to detect if a process is already running, and | 397 running process. This is used to detect if a process is already running, and |
398 inform the user of the PID. On process termination, the PID file is | 398 inform the user of the PID. On process termination, the PID file is |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 logging.info("OAuth credentials are invalid - exiting.") | 871 logging.info("OAuth credentials are invalid - exiting.") |
872 try: | 872 try: |
873 os.remove(auth.config_file) | 873 os.remove(auth.config_file) |
874 except: | 874 except: |
875 pass | 875 pass |
876 return 0 | 876 return 0 |
877 | 877 |
878 if __name__ == "__main__": | 878 if __name__ == "__main__": |
879 logging.basicConfig(level=logging.DEBUG) | 879 logging.basicConfig(level=logging.DEBUG) |
880 sys.exit(main()) | 880 sys.exit(main()) |
OLD | NEW |