| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 self.x_proc = subprocess.Popen(["Xvfb", ":%d" % display, | 280 self.x_proc = subprocess.Popen(["Xvfb", ":%d" % display, |
| 281 "-auth", X_AUTH_FILE, | 281 "-auth", X_AUTH_FILE, |
| 282 "-nolisten", "tcp", | 282 "-nolisten", "tcp", |
| 283 "-screen", "0", screen_option | 283 "-screen", "0", screen_option |
| 284 ] + extra_x_args) | 284 ] + extra_x_args) |
| 285 if not self.x_proc.pid: | 285 if not self.x_proc.pid: |
| 286 raise Exception("Could not start Xvfb.") | 286 raise Exception("Could not start Xvfb.") |
| 287 | 287 |
| 288 # Create clean environment for new session, so it is cleanly separated from | 288 # Create clean environment for new session, so it is cleanly separated from |
| 289 # the user's console X session. | 289 # the user's console X session. |
| 290 self.child_env = {"DISPLAY": ":%d" % display} | 290 self.child_env = { |
| 291 "DISPLAY": ":%d" % display, |
| 292 "REMOTING_ME2ME_SESSION": "1" } |
| 291 for key in [ | 293 for key in [ |
| 292 "HOME", | 294 "HOME", |
| 293 "LOGNAME", | 295 "LOGNAME", |
| 294 "PATH", | 296 "PATH", |
| 295 "SHELL", | 297 "SHELL", |
| 296 "USER", | 298 "USER", |
| 297 "USERNAME"]: | 299 "USERNAME"]: |
| 298 if os.environ.has_key(key): | 300 if os.environ.has_key(key): |
| 299 self.child_env[key] = os.environ[key] | 301 self.child_env[key] = os.environ[key] |
| 300 | 302 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 logging.info("Host ID has been deleted - exiting.") | 707 logging.info("Host ID has been deleted - exiting.") |
| 706 # Host config is no longer valid. Delete it, so the next time this | 708 # Host config is no longer valid. Delete it, so the next time this |
| 707 # script is run, a new Host ID will be created and registered. | 709 # script is run, a new Host ID will be created and registered. |
| 708 os.remove(host.config_file) | 710 os.remove(host.config_file) |
| 709 return 0 | 711 return 0 |
| 710 | 712 |
| 711 | 713 |
| 712 if __name__ == "__main__": | 714 if __name__ == "__main__": |
| 713 logging.basicConfig(level=logging.DEBUG) | 715 logging.basicConfig(level=logging.DEBUG) |
| 714 sys.exit(main()) | 716 sys.exit(main()) |
| OLD | NEW |