3
0
Fork 0
forked from mirrors/nixpkgs

* When using kdm, always use our xsession script, even when the

default session is selected.  This is because we always want to run
  our own initialisation (like starting ssh-agent).

* ssh-agent: don't start it is a child but have it re-exec the
  xsession script.  This ensures that ssh-agent quits when we log out.

* In the xsession script, don't redirect output to ~/.xsession-errors
  if the display manager is kdm, since kdm already does that.  In fact
  it uses ~/.xsession-errors<optional number> if there are concurrent
  X sessions.

* For consistency with other distros and the xdm manpage, exec the
  ~/.xsession script instead of sourcing it.  Do this for the "custom"
  session type provided by kdm.

svn path=/nixos/trunk/; revision=17087
This commit is contained in:
Eelco Dolstra 2009-09-13 13:34:52 +00:00
parent d1e7a90277
commit 6596a3ec55
2 changed files with 45 additions and 22 deletions

View file

@ -21,34 +21,46 @@ let
''
#! /bin/sh
exec > $HOME/.xsession-errors 2>&1
# Handle being called by kdm.
if test "''${1:0:1}" = /; then eval exec "$1"; fi
# The first argument of this script is the session type.
sessionType="$1"
if test "$sessionType" = default; then sessionType=""; fi
${optionalString (!cfg.displayManager.job.logsXsession) ''
exec > ~/.xsession-errors 2>&1
''}
${optionalString cfg.startSSHAgent ''
if test -z "$SSH_AUTH_SOCK"; then
# Restart this script as a child of the SSH agent. (It is
# also possible to start the agent as a child that prints
# the required environment variabled on stdout, but in
# that mode ssh-agent is not terminated when we log out.)
export SSH_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
exec ${pkgs.openssh}/bin/ssh-agent "$0" "$sessionType"
fi
''}
# Load X defaults.
if test -e ~/.Xdefaults; then
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
fi
source /etc/profile
### Load X defaults.
if test -e ~/.Xdefaults; then
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
# Allow the user to setup a custom session type.
if test "$sessionType" = custom; then
test -x ~/.xsession && exec ~/.xsession
sessionType="" # fall-thru if there is no ~/.xsession
fi
${optionalString cfg.startSSHAgent ''
### Start the SSH agent.
export SSH_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
eval $(${pkgs.openssh}/bin/ssh-agent)
''}
### Allow user to override system-wide configuration
if test -f ~/.xsession; then
source ~/.xsession
fi
# The first argument of this script is the session type
sessionType="$1"
# The session type "<desktop-manager> + <window-manager>", so
# The session type is "<desktop-manager> + <window-manager>", so
# extract those.
windowManager="''${arg##* + }"
windowManager="''${sessionType##* + }"
: ''${windowManager:=${cfg.windowManager.default}}
desktopManager="''${arg% + *}"
desktopManager="''${sessionType% + *}"
: ''${desktopManager:=${cfg.desktopManager.default}}
# Start the window manager.
@ -178,6 +190,15 @@ in
description = "Additional environment variables needed by the display manager.";
};
logsXsession = mkOption {
default = false;
description = ''
Whether the display manager redirects the
output of the session script to
<filename>~/.xsession-errors</filename>.
'';
};
};
};

View file

@ -18,6 +18,7 @@ let
[X-*-Core]
Xrdb=${pkgs.xlibs.xrdb}/bin/xrdb
SessionsDirs=${dmcfg.session.desktops}
Session=${dmcfg.session.script}
FailsafeClient=${pkgs.xterm}/bin/xterm
[X-:*-Core]
@ -76,6 +77,7 @@ in
services.xserver.displayManager.job =
{ execCmd = "${kdebase_workspace}/bin/kdm -config ${kdmrc}";
logsXsession = true;
};
security.pam.services = [ { name = "kde"; localLogin = true; ckHack = true; } ];