diff --git a/common_lib.sh b/common_lib.sh index 35d85cc..c1022d0 100644 --- a/common_lib.sh +++ b/common_lib.sh @@ -10,8 +10,10 @@ function init_repos(){ else echo -n "client name: " read -r CLIENT_NAME + echo -n "deploy key suffix. Leave blank if first: " + read -r DEPLOY_KEY_SUFFIX - if [ ! -f $HOME/.ssh/deploy_key ]; then + if [ ! -f $HOME/.ssh/deploy_key$DEPLOY_KEY_SUFFIX ]; then echo "create ssh key" echo -n "ssh passphrase: " @@ -26,7 +28,7 @@ function init_repos(){ 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$DEPLOY_KEY_SUFFIX echo "please upload now pub key by logging into user $CLIENT_NAME keys ..." echo "if user does not exit. login with admin user and create new user with name: $CLIENT_NAME" @@ -36,7 +38,7 @@ function init_repos(){ echo "https://git.service.wiseadvice.eu/user/settings/keys" echo " " - cat $HOME/.ssh/deploy_key.pub + cat $HOME/.ssh/deploy_key$DEPLOY_KEY_SUFFIX.pub fi echo " " @@ -56,7 +58,7 @@ function init_repos(){ cat <> $HOME/.ssh/config Host git.service.wiseadvice.eu HostName git.service.wiseadvice.eu - IdentityFile ~/.ssh/deploy_key + IdentityFile ~/.ssh/deploy_key$DEPLOY_KEY_SUFFIX Port 8422 IdentitiesOnly yes EOT