mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2026-01-25 04:27:54 +01:00
{bash,zsh}rc: use user-specific runtime directory rather than /tmp for ssh-agent
This commit is contained in:
parent
f43e244d42
commit
064885e8b4
14
rc/bashrc
14
rc/bashrc
@ -250,9 +250,15 @@ if [ -f ~/.gnupg/sshcontrol ]; then
|
|||||||
gpg-connect-agent updatestartuptty /bye > /dev/null 2>&1
|
gpg-connect-agent updatestartuptty /bye > /dev/null 2>&1
|
||||||
# otherwise use the normal ssh-agent
|
# otherwise use the normal ssh-agent
|
||||||
else
|
else
|
||||||
|
if hash xdg-user-dir 2> /dev/null; then
|
||||||
|
# if the output is going to /dev/null, it's non/existence doesn't matter
|
||||||
|
(ssh-agent -a $(xdg-user-dir RUNTIME)/sshagent > /dev/null 2>&1)
|
||||||
|
export SSH_AUTH_SOCK=$(xdg-user-dir RUNTIME)/sshagent
|
||||||
|
else
|
||||||
# if the output is going to /dev/null, it's non/existence doesn't matter
|
# if the output is going to /dev/null, it's non/existence doesn't matter
|
||||||
(ssh-agent -a /tmp/$USER.sshagent > /dev/null 2>&1)
|
(ssh-agent -a /tmp/$USER.sshagent > /dev/null 2>&1)
|
||||||
export SSH_AUTH_SOCK=/tmp/$USER.sshagent
|
export SSH_AUTH_SOCK=/tmp/$USER.sshagent
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# OS X ls colours (copied from https://apple.stackexchange.com/questions/33677/
|
# OS X ls colours (copied from https://apple.stackexchange.com/questions/33677/
|
||||||
@ -1027,9 +1033,9 @@ if [ -f ~/.bash_custom ]; then
|
|||||||
source ~/.bash_custom
|
source ~/.bash_custom
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If $TMUX, then TERM is tmux-256color
|
# Note if my xdg runtime dir setting is broken.
|
||||||
#if [ -v TMUX ]; then
|
if ! hash xdg-user-dir 2> /dev/null; then
|
||||||
# TERM=tmux-256color
|
echo "WARNING! xdg-user-dir not found."
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
# vim: filetype=bash
|
# vim: filetype=bash
|
||||||
|
|||||||
14
rc/zshrc
14
rc/zshrc
@ -206,9 +206,15 @@ if [ -f ~/.gnupg/sshcontrol ]; then
|
|||||||
gpg-connect-agent updatestartuptty /bye > /dev/null 2>&1
|
gpg-connect-agent updatestartuptty /bye > /dev/null 2>&1
|
||||||
# otherwise use the normal ssh-agent
|
# otherwise use the normal ssh-agent
|
||||||
else
|
else
|
||||||
|
if hash xdg-user-dir 2> /dev/null; then
|
||||||
|
# if the output is going to /dev/null, it's non/existence doesn't matter
|
||||||
|
(ssh-agent -a $(xdg-user-dir RUNTIME)/sshagent > /dev/null 2>&1)
|
||||||
|
export SSH_AUTH_SOCK=$(xdg-user-dir RUNTIME)/sshagent
|
||||||
|
else
|
||||||
# if the output is going to /dev/null, it's non/existence doesn't matter
|
# if the output is going to /dev/null, it's non/existence doesn't matter
|
||||||
(ssh-agent -a /tmp/$USER.sshagent > /dev/null 2>&1)
|
(ssh-agent -a /tmp/$USER.sshagent > /dev/null 2>&1)
|
||||||
export SSH_AUTH_SOCK=/tmp/$USER.sshagent
|
export SSH_AUTH_SOCK=/tmp/$USER.sshagent
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we are on Linux, enable apt progress bar and colours
|
# If we are on Linux, enable apt progress bar and colours
|
||||||
@ -1019,9 +1025,9 @@ if [ -f ~/.warnings ]; then
|
|||||||
source ~/.warnings
|
source ~/.warnings
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If $TMUX, then TERM is tmux-256color
|
# Note if my xdg runtime dir setting is broken.
|
||||||
#if [ -v TMUX ]; then
|
if ! hash xdg-user-dir 2> /dev/null; then
|
||||||
# TERM=tmux-256color
|
echo "WARNING! xdg-user-dir not found."
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
# vim: filetype=zsh
|
# vim: filetype=zsh
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user