OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 # the virtual session. Chrome doesn't support sharing a profile between | 387 # the virtual session. Chrome doesn't support sharing a profile between |
388 # multiple DISPLAYs, but Chrome Sync allows for a reasonable compromise. | 388 # multiple DISPLAYs, but Chrome Sync allows for a reasonable compromise. |
389 chrome_profile = os.path.join(CONFIG_DIR, "chrome-profile") | 389 chrome_profile = os.path.join(CONFIG_DIR, "chrome-profile") |
390 self.child_env["CHROME_USER_DATA_DIR"] = chrome_profile | 390 self.child_env["CHROME_USER_DATA_DIR"] = chrome_profile |
391 | 391 |
392 # Set SSH_AUTH_SOCK to the file name to listen on. | 392 # Set SSH_AUTH_SOCK to the file name to listen on. |
393 if self.ssh_auth_sockname: | 393 if self.ssh_auth_sockname: |
394 self.child_env["SSH_AUTH_SOCK"] = self.ssh_auth_sockname | 394 self.child_env["SSH_AUTH_SOCK"] = self.ssh_auth_sockname |
395 | 395 |
396 # Wait for X to be active. | 396 # Wait for X to be active. |
397 for _test in range(5): | 397 for _test in range(20): |
398 proc = subprocess.Popen("xdpyinfo", env=self.child_env, stdout=devnull) | 398 proc = subprocess.Popen("xdpyinfo", env=self.child_env, stdout=devnull) |
399 _pid, retcode = os.waitpid(proc.pid, 0) | 399 _pid, retcode = os.waitpid(proc.pid, 0) |
400 if retcode == 0: | 400 if retcode == 0: |
401 break | 401 break |
402 time.sleep(0.5) | 402 time.sleep(0.5) |
403 if retcode != 0: | 403 if retcode != 0: |
404 raise Exception("Could not connect to Xvfb.") | 404 raise Exception("Could not connect to Xvfb.") |
405 else: | 405 else: |
406 logging.info("Xvfb is active.") | 406 logging.info("Xvfb is active.") |
407 | 407 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 else: | 1252 else: |
1253 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) | 1253 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) |
1254 elif os.WIFSIGNALED(status): | 1254 elif os.WIFSIGNALED(status): |
1255 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) | 1255 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) |
1256 | 1256 |
1257 | 1257 |
1258 if __name__ == "__main__": | 1258 if __name__ == "__main__": |
1259 logging.basicConfig(level=logging.DEBUG, | 1259 logging.basicConfig(level=logging.DEBUG, |
1260 format="%(asctime)s:%(levelname)s:%(message)s") | 1260 format="%(asctime)s:%(levelname)s:%(message)s") |
1261 sys.exit(main()) | 1261 sys.exit(main()) |
OLD | NEW |