[systemd-devel] [PATCH] Add SHELL environment variable

Lennart Poettering lennart at poettering.net
Mon Sep 30 19:18:01 PDT 2013


On Mon, 23.09.13 21:01, Evan Callicoat (apsu at propter.net) wrote:

Thanks!

Applied!

> With the advent of systemd --user sessions, it's become very interesting to spawn X as a user unit, as well as accompanying processes that may have previously been in a .xinitrc/.xsession, or even just to replace a collection of XDG/GDM/KDM/etc session files with independent systemd --user units. The simplest case here would be to login on a tty, with the traditional /usr/sbin/login "login manager".
> 
> However, systemd --user (spawned by user at .service) is at the top level of the slice for the user, and does not inherit any environment variables from the login process. Given the number of common applications which rely on SHELL being set in the environment, it seems like the cleanest way to provide this variable is to set it to %s in the user at .service.
> 
> Ideally in the long-term, applications which rely on SHELL being set should be fixed to just grab it from getpwnam() or similar, but until that becomes more common, I propose this simple change to make user sessions a little bit nicer out of the box.
> 
> ---
>  units/user at .service.in | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/units/user at .service.in b/units/user at .service.in
> index 3f8b59d..3718a57 100644
> --- a/units/user at .service.in
> +++ b/units/user at .service.in
> @@ -13,6 +13,7 @@ After=systemd-user-sessions.service
>  User=%I
>  PAMName=systemd-user
>  Type=notify
> +Environment=SHELL=%s
>  ExecStart=- at rootlibexecdir@/systemd --user
>  Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket
>  Slice=user-%i.slice



> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel



Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list