export SSH_AUTH_SOCK=${HOME}/.ssh/agent if ! pgrep -u ${USER} ssh-agent > /dev/null; then rm -f ${SSH_AUTH_SOCK} fi if [ ! -S ${SSH_AUTH_SOCK} ]; then eval $(ssh-agent -a ${SSH_AUTH_SOCK} 2> /dev/null) fi if test -z "${XDG_RUNTIME_DIR}"; then export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir if ! test -d "${XDG_RUNTIME_DIR}"; then mkdir "${XDG_RUNTIME_DIR}" chmod 0700 "${XDG_RUNTIME_DIR}" fi fi if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then startx fi