summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-12 02:36:07 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-12 02:36:07 +0000
commit3136db987e85ae8c0895ca667c14d9d4f1bcd6c2 (patch)
tree03d757e20128f1f46b1cbfebd1363ecf4cd08d2f /remoting/tools
parent2d293374c34f335f47290b3825f6e11a3df371c8 (diff)
downloadchromium_src-3136db987e85ae8c0895ca667c14d9d4f1bcd6c2.zip
chromium_src-3136db987e85ae8c0895ca667c14d9d4f1bcd6c2.tar.gz
chromium_src-3136db987e85ae8c0895ca667c14d9d4f1bcd6c2.tar.bz2
Load /etc/environment in Me2Me session
This is a "quick fix". A much better fix would be to use the system's Display Manager (for example, lightdm) to start sessions. BUG=169641 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11874014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-xremoting/tools/me2me_virtual_host.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py
index 291509f..3327981 100755
--- a/remoting/tools/me2me_virtual_host.py
+++ b/remoting/tools/me2me_virtual_host.py
@@ -203,6 +203,7 @@ class Desktop:
# Create clean environment for new session, so it is cleanly separated from
# the user's console X session.
self.child_env = {}
+
for key in [
"HOME",
"LANG",
@@ -215,6 +216,26 @@ class Desktop:
if os.environ.has_key(key):
self.child_env[key] = os.environ[key]
+ # Read from /etc/environment if it exists, as it is a standard place to
+ # store system-wide environment settings. During a normal login, this would
+ # typically be done by the pam_env PAM module, depending on the local PAM
+ # configuration.
+ env_filename = "/etc/environment"
+ try:
+ with open(env_filename, "r") as env_file:
+ for line in env_file:
+ line = line.rstrip("\n")
+ # Split at the first "=", leaving any further instances in the value.
+ key_value_pair = line.split("=", 1)
+ if len(key_value_pair) == 2:
+ key, value = tuple(key_value_pair)
+ # The file stores key=value assignments, but the value may be
+ # quoted, so strip leading & trailing quotes from it.
+ value = value.strip("'\"")
+ self.child_env[key] = value
+ except IOError:
+ logging.info("Failed to read %s, skipping." % env_filename)
+
def _setup_pulseaudio(self):
self.pulseaudio_pipe = None