5
0
Fork 0

commit by to_remotes 2024-05-03 13:20:40 +0200 from vmdevhw

main
Holger Wasem 2024-05-03 13:20:40 +02:00
parent a6886d4beb
commit 29bf195b45
1 changed files with 19 additions and 18 deletions

View File

@ -10,35 +10,35 @@ function init_repos(){
else else
echo -n "client name: " echo -n "client name: "
read -r 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 ]; then
echo "create ssh key" echo -n "deploy key suffix. Leave blank if first key to be deployed for user: "
echo -n "ssh passphrase: " read -r DEPLOY_KEY_SUFFIX
echo "create ssh key"
echo -n "ssh passphrase: "
stty_orig=$(stty -g) # save original terminal setting. stty_orig=$(stty -g) # save original terminal setting.
stty -echo stty -echo
read -r passphrase read -r passphrase
stty "$stty_orig" # restore terminal setting. 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$DEPLOY_KEY_SUFFIX" -f $HOME/.ssh/deploy_key ssh-keygen -t rsa -N "$passphrase" -C "deploy_key_$CLIENT_NAME$DEPLOY_KEY_SUFFIX" -f $HOME/.ssh/deploy_key
echo "please upload now pub key by logging into user $CLIENT_NAME keys ..." 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" echo "if user does not exit. login with admin user and create new user with name: $CLIENT_NAME"
echo "make sure the user $CLIENT_NAME is in team shared_deployments and is allowed to pull repository cimp_$CLIENT_NAME" echo "make sure the user $CLIENT_NAME is in team shared_deployments and is allowed to pull repository cimp_$CLIENT_NAME"
echo "https://git.service.wiseadvice.eu/user/settings/keys" echo "https://git.service.wiseadvice.eu/user/settings/keys"
echo " " echo " "
cat $HOME/.ssh/deploy_key.pub cat $HOME/.ssh/deploy_key.pub
fi fi
echo " " echo " "
@ -94,7 +94,8 @@ EOT
function clone_repo_with_retry(){ function clone_repo_with_retry(){
REPO_NAME=$1 REPO_NAME=$1
echo "starting to pull into $(pwd)" echo "starting to pull into $(pwd) with command"
echo "git clone git@git.service.wiseadvice.eu:wiseadvice_apps/$REPO_NAME.git -b main"
git clone git@git.service.wiseadvice.eu:wiseadvice_apps/$REPO_NAME.git -b main git clone git@git.service.wiseadvice.eu:wiseadvice_apps/$REPO_NAME.git -b main
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
echo " " echo " "