OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 # Start remoting host | 264 # Start remoting host |
265 command = locate_executable(REMOTING_COMMAND) | 265 command = locate_executable(REMOTING_COMMAND) |
266 self.host_proc = subprocess.Popen(command, env=self.child_env) | 266 self.host_proc = subprocess.Popen(command, env=self.child_env) |
267 if not self.host_proc.pid: | 267 if not self.host_proc.pid: |
268 raise Exception("Could not start remoting host") | 268 raise Exception("Could not start remoting host") |
269 | 269 |
270 | 270 |
271 def main(): | 271 def main(): |
272 atexit.register(cleanup) | 272 atexit.register(cleanup) |
273 | 273 |
274 for s in [signal.SIGINT, signal.SIGTERM]: | 274 for s in [signal.SIGHUP, signal.SIGINT, signal.SIGTERM]: |
275 signal.signal(s, signal_handler) | 275 signal.signal(s, signal_handler) |
276 | 276 |
277 # Ensure full path to config directory exists. | 277 # Ensure full path to config directory exists. |
278 if not os.path.exists(CONFIG_DIR): | 278 if not os.path.exists(CONFIG_DIR): |
279 os.makedirs(CONFIG_DIR, mode=0700) | 279 os.makedirs(CONFIG_DIR, mode=0700) |
280 | 280 |
281 auth = Authentication(os.path.join(CONFIG_DIR, "auth.json")) | 281 auth = Authentication(os.path.join(CONFIG_DIR, "auth.json")) |
282 if not auth.load_config(): | 282 if not auth.load_config(): |
283 try: | 283 try: |
284 auth.refresh_tokens() | 284 auth.refresh_tokens() |
(...skipping 23 matching lines...) Expand all Loading... |
308 logging.info("X server process terminated with code %d", status) | 308 logging.info("X server process terminated with code %d", status) |
309 break | 309 break |
310 | 310 |
311 if pid == desktop.host_proc.pid: | 311 if pid == desktop.host_proc.pid: |
312 logging.info("Host process terminated, relaunching") | 312 logging.info("Host process terminated, relaunching") |
313 desktop.launch_host() | 313 desktop.launch_host() |
314 | 314 |
315 if __name__ == "__main__": | 315 if __name__ == "__main__": |
316 logging.basicConfig(level=logging.DEBUG) | 316 logging.basicConfig(level=logging.DEBUG) |
317 sys.exit(main()) | 317 sys.exit(main()) |
OLD | NEW |