[systemd-devel] XDM and systemd --user
Matthew Monaco
matt at 0x01b.net
Fri Sep 28 06:47:23 PDT 2012
On 09/28/2012 05:54 AM, Peter Lemenkov wrote:
> Hello All!
>
> 2012/9/28 Peeters Simon <peeters.simon at gmail.com>:
>>> Second question - I've lost all /etc/profile stuff which was set up
>>> somehow in the depths of Xorg-related script's swamp. I'd like to run
>>> it (as well as some other shell scripts) and borrow its envvars (at
>>> least for some applications) - is it possible?
>>
>> systemd currently does not parse /etc/profile (and never will?)
>> you can work around by creating a shell script like this:
>>
>> cat <<EOF > /bin/systemd-session
>> #!/bin/bash -l
>> exec /usr/bin/systemd --user $@
>> EOF
>>
>> and point your xdm-config to /bin/systemd-session
>> (this lets bash start a 'login' shell, thus parsing /etc/profile. and
>> exec's systemd afterwards)
>
> Thanks! Works like a charm.
>
>
LightDM here, but I'm doing this with the Xsession script itself.
---------------------------8<---------------------------------------
#!/bin/bash
info() {
printf "Xsession: $*\n" >&2
}
info "hello!"
info "running from -- $0"
info "sourcing profiles:"
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
if [[ -f "$file" ]]; then
info "\t$file"
source "$file"
fi
done
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/dbus/user_bus_socket
info "exported DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS"
info "goodbye! starting systemd"
exec systemd --user
info "error running systemd"
---------------------------8<---------------------------------------
This is actually $HOME/.Xsession. I have a more general system-wide
/etc/lightdm/Xsession, for users not on systemd --user yet. The first thing it
does is check for $HOME/.Xsession and exec it if available.
Everything is done through systemd units except launching gnome-keyring-daemon
which is done through pam and Xorg which is already launched by the display manager.
Here's my /etc/pam.d/lightdm
---------------------------8<---------------------------------------
#%PAM-1.0
auth requisite pam_nologin.so
auth required pam_env.so
auth required pam_unix.so
auth optional pam_gnome_keyring.so
account required pam_unix.so
password required pam_unix.so
session required pam_limits.so
session required pam_unix.so
session required pam_loginuid.so
session required pam_systemd.so
session optional pam_gnome_keyring.so auto_start
---------------------------8<---------------------------------------
More information about the systemd-devel
mailing list