~mdw
/
profile
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
af254ca
)
bin/start-ssh-agent: Hoist variables for standard socket name.
author
Mark Wooding
<mdw@distorted.org.uk>
Sat, 5 Nov 2016 21:28:22 +0000
(21:28 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Wed, 30 Nov 2016 12:52:36 +0000
(12:52 +0000)
bin/start-ssh-agent
patch
|
blob
|
blame
|
history
diff --git
a/bin/start-ssh-agent
b/bin/start-ssh-agent
index
30c0bc7
..
6183ed5
100755
(executable)
--- a/
bin/start-ssh-agent
+++ b/
bin/start-ssh-agent
@@
-29,6
+29,12
@@
case $chosen,$style in
;;
esac
;;
esac
+## Some useful variables.
+hostname=${HOST-$(hostname)}
+user=${USER-${LOGNAME-$(id -un)}}
+dir=$TMPDIR/.ssh-agent.$hostname.$user
+socket=$dir/sock; pid=$dir/pid
+
### Should I start a new agent?
case "$force,$SSH_AUTH_SOCK" in
t,* | nil,)
### Should I start a new agent?
case "$force,$SSH_AUTH_SOCK" in
t,* | nil,)
@@
-44,9
+50,6
@@
esac
### If so, do that
case $foundp in
nil)
### If so, do that
case $foundp in
nil)
- hostname=${HOST-$(hostname)}
- user=${USER-${LOGNAME-$(whoami)}}
- dir=$TMPDIR/.ssh-agent.$hostname.$user; socket=$dir/sock; pid=$dir/pid
mkdir -p -m700 "$dir"
SSH_AUTH_SOCK=$socket; export SSH_AUTH_SOCK
set +e; ssh-add -l >/dev/null 2>&1; rc=$?; set -e
mkdir -p -m700 "$dir"
SSH_AUTH_SOCK=$socket; export SSH_AUTH_SOCK
set +e; ssh-add -l >/dev/null 2>&1; rc=$?; set -e