summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-02-03 09:07:35 +0100
committerLudovic Courtès <ludo@gnu.org>2016-02-03 11:21:11 +0100
commit2a5f0db4c45679cac6a747a48993fe73982cadca (patch)
treef539ef226e531132bcfef616693c29d3d39ac93b
parent3a6a0f6013a5953711c71ea2745e1144d125e7fb (diff)
downloadguix-2a5f0db4c45679cac6a747a48993fe73982cadca.tar.gz
system: /etc/profile reads /etc/environment for the sake of lshd.
Fixes <http://bugs.gnu.org/22175>.

* gnu/system.scm (operating-system-etc-service)[profile]: Add hack to
define variables from /etc/environment.
-rw-r--r--gnu/system.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index dea7d882a8..d4759a08ad 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -465,6 +465,17 @@ else
   export PATH=\"$HOME/.guix-profile/bin:$PATH\"
 fi
 
+# Since 'lshd' does not use pam_env, /etc/environment must be explicitly
+# loaded when someone logs in via SSH.  See <http://bugs.gnu.org/22175>.
+# We need 'PATH' to be defined here, for 'cat' and 'cut'.
+if [ -f /etc/environment -a -n \"$SSH_CLIENT\" \\
+     -a -z \"$LINUX_MODULE_DIRECTORY\" ]
+then
+  . /etc/environment
+  export `cat /etc/environment | cut -d= -f1`
+fi
+
+
 # Allow GStreamer-based applications to find plugins.
 export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\"