File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,17 @@ import (
21
21
"github.com/devfile/devworkspace-operator/pkg/library/lifecycle"
22
22
)
23
23
24
- const commandLine = `SSH_ENV_PATH=$HOME/ssh-environment \
25
- && if [ -f /etc/ssh/passphrase ] && command -v ssh-add >/dev/null; \
26
- then ssh-agent | sed 's/^echo/#echo/' > $SSH_ENV_PATH \
27
- && chmod 600 $SSH_ENV_PATH && source $SSH_ENV_PATH \
28
- && ssh-add /etc/ssh/dwo_ssh_key < /etc/ssh/passphrase \
29
- && if [ -f $HOME/.bashrc ] && [ -w $HOME/.bashrc ]; then echo "source ${SSH_ENV_PATH}" >> $HOME/.bashrc; fi; fi`
24
+ const commandLine = `(
25
+ SSH_ENV_PATH=$HOME/ssh-environment && \
26
+ if [ -f /etc/ssh/passphrase ] && [ -w $HOME ] && command -v ssh-add >/dev/null && command -v ssh-agent >/dev/null; then
27
+ ssh-agent | sed 's/^echo/#echo/' > $SSH_ENV_PATH \
28
+ && chmod 600 $SSH_ENV_PATH \
29
+ && source $SSH_ENV_PATH \
30
+ && if timeout 3 ssh-add /etc/ssh/dwo_ssh_key < /etc/ssh/passphrase && [ -f $HOME/.bashrc ] && [ -w $HOME/.bashrc ]; then
31
+ echo "source ${SSH_ENV_PATH}" >> $HOME/.bashrc
32
+ fi
33
+ fi
34
+ ) || true`
30
35
31
36
// AddSshAgentPostStartEvent Start ssh-agent and add the default ssh key to it, if the ssh key has a passphrase.
32
37
// Initialise the ssh-agent session env variables in the user .bashrc file.
You can’t perform that action at this time.
0 commit comments