Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #178219

Re: The same environment variables everywhere

From Teemu Likonen <tlikonen@iki.fi>
Newsgroups linux.debian.user
Subject Re: The same environment variables everywhere
Date 2017-02-27 19:00 +0100
Message-ID <tfxKx-vQ-7@gated-at.bofh.it> (permalink)
References (2 earlier) <tflzI-iZ-1@gated-at.bofh.it> <tfoxz-2Ks-5@gated-at.bofh.it> <tfoHg-2QD-11@gated-at.bofh.it> <tftxg-68T-5@gated-at.bofh.it> <tfwYa-b8-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

David Wright [2017-02-27 10:56:55-06] wrote:

>>     systemctl --user import-enviroment
>
> Is that typo actually in the file?

No. I just (mis)typed those "files" here. In practice they contain quite
a lot more than that.

>> ~/.xsession:
>> 
>>     . ~/.profile
>
> My profile has side effects. Calling it from ~/.xsession
> would repeat them, which would be undesirable.

I moved my variable assignments to ~/.environment.sh and source that to
~/.profile and ~/.xsession.

> Have you tried putting an EnvironmentFile= in here (man 5
> systemd.service)? You could source the file from elsewhere if required
> so that you only need one set of definitions.

(EnvironmentFile's primary description is in systemd.exec(5).)

Doesn't work well with services that need X session which sets DISPLAY,
XAUTHORITY, GPG_AGENT_INFO, SSH_AUTH_SOCK and maybe other things. Some
of them have no static values. So, it's simpler to have things like:

~/.xsession:

    . ~/.environment.sh     # Import my variables.

    systemctl --user import-environment
    systemctl --user start [service-that-needs-X-session-environment]
    my-window-manager
    systemctl --user stop [service-that-needs-X-session-environment]

-- 
/// Teemu Likonen   - .-..   <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

The same environment variables everywhere Teemu Likonen <tlikonen@iki.fi> - 2017-02-26 13:30 +0100
  Re: The same environment variables everywhere Matthias Bodenbinder <matthias@bodenbinder.de> - 2017-02-26 21:00 +0100
    Re: The same environment variables everywhere Stefan Monnier <monnier@iro.umontreal.ca> - 2017-02-27 06:00 +0100
      Re: The same environment variables everywhere deloptes <deloptes@gmail.com> - 2017-02-27 09:10 +0100
        Re: The same environment variables everywhere <tomas@tuxteam.de> - 2017-02-27 09:20 +0100
          Re: The same environment variables everywhere GiaThnYgeia <GiaThnYgeia@openmailbox.org> - 2017-02-27 12:40 +0100
            Re: The same environment variables everywhere Elimar Riesebieter <riesebie@lxtec.de> - 2017-02-27 13:40 +0100
          Re: The same environment variables everywhere Teemu Likonen <tlikonen@iki.fi> - 2017-02-27 14:30 +0100
            Re: The same environment variables everywhere David Wright <deblis@lionunicorn.co.uk> - 2017-02-27 18:10 +0100
              Re: The same environment variables everywhere Teemu Likonen <tlikonen@iki.fi> - 2017-02-27 19:00 +0100
                Re: The same environment variables everywhere Nicolas George <george@nsup.org> - 2017-02-27 19:20 +0100
                systemd service environment Teemu Likonen <tlikonen@iki.fi> - 2017-02-27 19:50 +0100
          Re: The same environment variables everywhere deloptes <deloptes@gmail.com> - 2017-02-27 19:30 +0100
  Re: The same environment variables everywhere Greg Wooledge <wooledg@eeg.ccf.org> - 2017-02-27 14:20 +0100

csiph-web