Subject: Re: bug#27386: offloading documentation and env

From: Divan Santana <[email-masked]>
Date: Fri, 29 Sep 2017 21:33:46 +0200

> Divan Santana <[email-masked]> skribis:
>
>> So guixsd.santanas.co.za is my build system VM.
>> Laptop, is a guixsd system I want to not compile code, and rather offload.
>>
>> root@laptop ~# ssh [email-masked] env |grep GUILE_
>>
>> Returns nothing.
>>
>> However, an interactive session has the correct environment variables.
>> So I suppose one could set this via the .zshenv or .bash_profile .
>
> Right.  On GuixSD, the default .bash_profile sources .bashrc, and the
> default .bashrc has this:
>
> --8<---------------cut here---------------start------------->8---
> if [ -n "$SSH_CLIENT" -a -z "`type -P cat`" ]
> then
>     # We are being invoked from a non-interactive SSH session
>     # (as in "ssh host command") but 'cat' cannot be found
>     # in $PATH.  Source /etc/profile so we get $PATH and other
>     # essential variables.
>     source /etc/profile
> fi
> --8<---------------cut here---------------end--------------->8---
>
> I suggest you do something similar.

Thanks Ludo.

Though, I do have the default .bashrc and .bash_profile in place and
yet it's not working, by default.

  admin@guixsd ~$ diff .bash_profile /etc/skel/.bash_profile
  admin@guixsd ~$ diff .bashrc /etc/skel/.bashrc
  25a26
  > alias grep='grep --color'
  admin@guixsd ~$

So I'm assuming this doesn't work by default for all?
Unless it's because I configured the users shell to zsh, I doubt.
Because, when switching it back to bash it still doesn't work. And the
skel files are correctly in place.

It does have your above suggestion in place:

  admin@guixsd ~$ cat .bash_profile
  # Honor per-interactive-shell startup file
  if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
  admin@guixsd ~$ cat .bashrc
  # Bash initialization for interactive non-login shells and
  # for remote shells (info "(bash) Bash Startup Files").

  # Export 'SHELL' to child processes.  Programs such as 'screen'
  # honor it and otherwise use /bin/sh.
  export SHELL

  if [ -n "$SSH_CLIENT" -a -z "`type -P cat`" ]
  then
      # We are being invoked from a non-interactive SSH session
      # (as in "ssh host command") but 'cat' cannot be found
      # in $PATH.  Source /etc/profile so we get $PATH and other
      # essential variables.
      source /etc/profile
  fi

--
Divan