chiark / gitweb /
units: Add SHELL environment variable
authorEvan Callicoat <apsu@propter.net>
Tue, 24 Sep 2013 02:01:04 +0000 (21:01 -0500)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Oct 2013 02:17:31 +0000 (04:17 +0200)
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@.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@.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@.service.in

index 3f8b59d07fee6abb87e5af861ab8fa9446eb4564..3718a57087c457000d0f7c1b0c56bd9c1799f740 100644 (file)
@@ -13,6 +13,7 @@ After=systemd-user-sessions.service
 User=%I
 PAMName=systemd-user
 Type=notify
+Environment=SHELL=%s
 ExecStart=-@rootlibexecdir@/systemd --user
 Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket
 Slice=user-%i.slice