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. |
11 | 11 |
12 import atexit | 12 import atexit |
13 import errno | 13 import errno |
14 import fcntl | 14 import fcntl |
15 import getpass | 15 import getpass |
16 import grp | 16 import grp |
17 import hashlib | 17 import hashlib |
18 import json | 18 import json |
19 import logging | 19 import logging |
20 import optparse | 20 import optparse |
21 import os | 21 import os |
22 import pipes | 22 import pipes |
| 23 import platform |
23 import psutil | 24 import psutil |
24 import platform | 25 import platform |
25 import signal | 26 import signal |
26 import socket | 27 import socket |
27 import subprocess | 28 import subprocess |
28 import sys | 29 import sys |
29 import tempfile | 30 import tempfile |
30 import time | 31 import time |
31 import uuid | 32 import uuid |
32 | 33 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 "LANG", | 248 "LANG", |
248 "LOGNAME", | 249 "LOGNAME", |
249 "PATH", | 250 "PATH", |
250 "SHELL", | 251 "SHELL", |
251 "USER", | 252 "USER", |
252 "USERNAME", | 253 "USERNAME", |
253 LOG_FILE_ENV_VAR]: | 254 LOG_FILE_ENV_VAR]: |
254 if os.environ.has_key(key): | 255 if os.environ.has_key(key): |
255 self.child_env[key] = os.environ[key] | 256 self.child_env[key] = os.environ[key] |
256 | 257 |
| 258 # Ensure that the software-rendering GL drivers are loaded by the desktop |
| 259 # session, instead of any hardware GL drivers installed on the system. |
| 260 self.child_env["LD_LIBRARY_PATH"] = ( |
| 261 "/usr/lib/%(arch)s-linux-gnu/mesa:" |
| 262 "/usr/lib/%(arch)s-linux-gnu/dri:" |
| 263 "/usr/lib/%(arch)s-linux-gnu/gallium-pipe" % |
| 264 { "arch": platform.machine() }) |
| 265 |
257 # Read from /etc/environment if it exists, as it is a standard place to | 266 # Read from /etc/environment if it exists, as it is a standard place to |
258 # store system-wide environment settings. During a normal login, this would | 267 # store system-wide environment settings. During a normal login, this would |
259 # typically be done by the pam_env PAM module, depending on the local PAM | 268 # typically be done by the pam_env PAM module, depending on the local PAM |
260 # configuration. | 269 # configuration. |
261 env_filename = "/etc/environment" | 270 env_filename = "/etc/environment" |
262 try: | 271 try: |
263 with open(env_filename, "r") as env_file: | 272 with open(env_filename, "r") as env_file: |
264 for line in env_file: | 273 for line in env_file: |
265 line = line.rstrip("\n") | 274 line = line.rstrip("\n") |
266 # Split at the first "=", leaving any further instances in the value. | 275 # Split at the first "=", leaving any further instances in the value. |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 else: | 1234 else: |
1226 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) | 1235 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) |
1227 elif os.WIFSIGNALED(status): | 1236 elif os.WIFSIGNALED(status): |
1228 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) | 1237 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) |
1229 | 1238 |
1230 | 1239 |
1231 if __name__ == "__main__": | 1240 if __name__ == "__main__": |
1232 logging.basicConfig(level=logging.DEBUG, | 1241 logging.basicConfig(level=logging.DEBUG, |
1233 format="%(asctime)s:%(levelname)s:%(message)s") | 1242 format="%(asctime)s:%(levelname)s:%(message)s") |
1234 sys.exit(main()) | 1243 sys.exit(main()) |
OLD | NEW |