openssh/ssh-askpass

45 lines
792 B
Bash

#!/bin/bash
SESSION=
case "$DESKTOP_SESSION" in
kde) SESSION=kde ;;
gnome) SESSION=gnome ;;
esac
if [ -z "$SESSION" ] ; then
WM="${WINDOWMANAGER##*/}"
case "$WM" in
*kde*) SESSION=kde ;;
*gnome*) SESSION=gnome ;;
esac
fi
if [ -z "$SESSION" ] ; then
if [ -n "$KDE_FULL_SESSION" ] ; then
SESSION=kde
fi
if [ -n "$GNOME_DESKTOP_SESSION_ID" ] ; then
SESSION=gnome
fi
fi
GNOME_SSH_ASKPASS="/usr/lib/ssh/gnome-ssh-askpass"
X11_SSH_ASKPASS="/usr/lib/ssh/x11-ssh-askpass"
# note: if there is ever a kde-ssh-askpass, just add it based on SESSION=kde
case "$SESSION" in
gnome)
if [ -f $GNOME_SSH_ASKPASS ]; then
exec $GNOME_SSH_ASKPASS ${1+"$@"}
else
exec $X11_SSH_ASKPASS ${1+"$@"}
fi
;;
*)
exec $X11_SSH_ASKPASS ${1+"$@"}
;;
esac