aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_profile
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2018-06-04 18:05:08 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2018-06-04 22:00:02 +0300
commit374e073d5e648f3506e646b015f3bbf3925c64f6 (patch)
tree19fe9b4fd29c30ddcadf053dbe5bb60a1b2f844c /%HOME%/.bash_profile
parent.xsessionrc: refactoring (diff)
downloadlinux-home-374e073d5e648f3506e646b015f3bbf3925c64f6.tar.gz
linux-home-374e073d5e648f3506e646b015f3bbf3925c64f6.zip
move ssh-related stuff to ssh.sh
spawn_ssh_agent no longer creates ~/.ssh_agent.sh, because in cron jobs it's pretty useless actually, since they are typically run when I'm not connected via ssh.
Diffstat (limited to '')
-rw-r--r--%HOME%/.bash_profile24
1 files changed, 2 insertions, 22 deletions
diff --git a/%HOME%/.bash_profile b/%HOME%/.bash_profile
index fb2b58f..b42f274 100644
--- a/%HOME%/.bash_profile
+++ b/%HOME%/.bash_profile
@@ -2,25 +2,5 @@
echo "Welcome to $( hostname )"
-kill_ssh_agent() {
- [ -n "${SSH_AGENT_PID:+x}" ] && kill "$SSH_AGENT_PID"
- local output_path="$HOME/.ssh_agent.sh"
- rm -f -- "$output_path"
-}
-
-spawn_ssh_agent() {
- # This spawns ssh-agent and exports its variables to ~/.ssh_agent.sh,
- # to be used in cron jobs and such.
- local output_path="$HOME/.ssh_agent.sh"
- [ -z "${SSH_AGENT_PID:+x}" ] \
- && command -v ssh-agent > /dev/null 2>&1 \
- && touch -- "$output_path" \
- && chmod 0600 -- "$output_path" \
- && ssh-agent -s > "$output_path" \
- && source "$output_path" > /dev/null \
- && [ -n "${SSH_AGENT_PID:+x}" ] \
- && echo "Spawned ssh-agent with PID: $SSH_AGENT_PID." \
- && trap kill_ssh_agent EXIT
-}
-
-spawn_ssh_agent
+command -v spawn_ssh_agent > /dev/null 2>&1 \
+ && spawn_ssh_agent