diff --git a/init.sh b/init.sh index b06bda0..e39955a 100755 --- a/init.sh +++ b/init.sh @@ -39,27 +39,31 @@ if [ -d "$WA_REPO" ]; then else echo -n "client name: " read -r CLIENT_NAME - echo "create ssh key" - echo -n "ssh passphrase: " - stty_orig=$(stty -g) # save original terminal setting. - stty -echo - read -r passphrase - stty "$stty_orig" # restore terminal setting. + if [ -z $HOME/.ssh/deploy_key ]; then + + echo "create ssh key" + echo -n "ssh passphrase: " + + stty_orig=$(stty -g) # save original terminal setting. + stty -echo + read -r passphrase + stty "$stty_orig" # restore terminal setting. - echo "1. client name: $CLIENT_NAME" + echo "1. client name: $CLIENT_NAME" - mkdir -p $HOME/.ssh + mkdir -p $HOME/.ssh - ssh-keygen -t rsa -N "$passphrase" -C "deploy_key_$CLIENT_NAME" -f $HOME/.ssh/deploy_key + ssh-keygen -t rsa -N "$passphrase" -C "deploy_key_$CLIENT_NAME" -f $HOME/.ssh/deploy_key - echo "please upload now pub key bay logging into user $CLIENT_NAME keys ..." + echo "please upload now pub key bay logging into user $CLIENT_NAME keys ..." - echo "firefox https://git.service.wiseadvice.eu/user/settings/keys" - echo " " + echo "firefox https://git.service.wiseadvice.eu/user/settings/keys" + echo " " - cat $HOME/.ssh/deploy_key.pub + cat $HOME/.ssh/deploy_key.pub + fi echo " " echo -n "ready to pull? type yes: "