![](https://seccdn.libravatar.org/avatar/d1fa340dd0cbb328b697a0d70a47c83f.jpg?s=120&d=mm&r=g)
Am Sonntag, 20. März 2005 14:56 schrieb Mathias Homann:
Hallo Liste,
vor lauter tipperei und aufhomepagehochladerei vergass ich den erwähnten patch für die Xsession datei auch wirklich anzuhängen... ich lad den auch mal auf meine page hoch: http://eregion.privat.t-online.de/Xsession.diff da isser: --- Xsession~ 2005-03-16 23:38:04.000000000 +0100 +++ Xsession 2005-03-16 23:38:04.000000000 +0100 @@ -1,5 +1,14 @@ #! /bin/sh # Xsession - run as user +# +# If ssh is configured and ssh-agent is wanted set "yes" +# +usessh="yes" + +# +# If gpg is configured and gpg-agent is wanted set "yes" +# +usegpg="yes" # Note that the respective logout scripts are not sourced. case $SHELL in @@ -40,21 +49,71 @@ [ -f /etc/xprofile ] && . /etc/xprofile [ -f $HOME/.xprofile ] && . $HOME/.xprofile +# +# Run ssh-agent only if ssh is configured and avaliable. +# +SSH_ASKPASS="" +if test "$usessh" = "yes" -a -d $HOME/.ssh ; then + type -p ssh-agent > /dev/null 2>&1 && sshagent="yes" + if test -x /usr/lib/ssh/x11-ssh-askpass ; then + SSH_ASKPASS="/usr/lib/ssh/x11-ssh-askpass" + export SSH_ASKPASS + elif test -x /usr/lib64/ssh/x11-ssh-askpass ; then + SSH_ASKPASS="/usr/lib64/ssh/x11-ssh-askpass" + export SSH_ASKPASS + fi +fi + +# +# Run gpg-agent only if gpg-agent is configured and avaliable. +# Note that the method in the following few lines is necessary +# because the gpg2 developers force every user to use the +# daemon mode regardless of the staying gpg-agent after leaving +# the X session. If the method of the ssh-agent of getting +# a secure X session would be used, the number of running +# gpg-agent would increase on every new X session. +# +if test "$usegpg" = "yes" -a -d $HOME/.gnupg ; then + GPG_AGENT="$(type -p gpg-agent 2>/dev/null)" + if test -n "$GPG_AGENT" -a -x "$GPG_AGENT"; then + GPG_AGENT_FILE=$HOME/.gnupg/agent.info + GPG_AGPID_FILE=$HOME/.gnupg/agent.pid + if /sbin/checkproc -p "$GPG_AGPID_FILE" "$GPG_AGENT" ; then + read -t1 GPG_AGENT_INFO < "$GPG_AGENT_FILE" + export GPG_AGENT_INFO + else + eval $($GPG_AGENT --sh --daemon 2>/dev/null) + GPG_AGENT_PID="${GPG_AGENT_INFO#*:}" + GPG_AGENT_PID="${GPG_AGENT_PID%%:*}" + echo "$GPG_AGENT_INFO" > "$GPG_AGENT_FILE" + echo "$GPG_AGENT_PID" > "$GPG_AGPID_FILE" + fi + fi +fi + case $1 in "") - exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION is no valid session." + WINDOWMANAGER="xmessage -center -buttons OK:0 -default OK \"Sorry, $DESKTOP_SESSION is no valid session.\"" ;; failsafe) - exec xterm -geometry 80x24-0-0 + WINDOWMANAGER="xterm -geometry 80x24-0-0" ;; custom) - exec $HOME/.xsession + WINDOWMANAGER="$HOME/.xsession" ;; default) - exec /opt/kde3/bin/startkde + WINDOWMANAGER="/opt/kde3/bin/startkde" ;; *) - eval exec "$1" + WINDOWMANAGER="$1" ;; esac + +test -r $HOME/.xim && source $HOME/.xim +if test "$sshagent" = "yes" ; then + exec ssh-agent $WINDOWMANAGER +else + exec $WINDOWMANAGER +fi + exec xmessage -center -buttons OK:0 -default OK "Sorry, cannot execute $1. Check $DESKTOP_SESSION.desktop."