Updated Update Script

This commit is contained in:
konrad 2017-04-27 20:46:47 +02:00 committed by kolaente
parent 289ad31c61
commit a01bcc86a7
1 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,26 @@
#!/bin/bash
#ssh-agent bash -c 'ssh-add /mnt/drive/wobsites/life/keys/deploy; git clone ssh://git@git.mowie.cc:9022/Websites/Life-Homepage.git /mnt/drive/wobsites/life/deploy-test'
git --version
while getopts ':k:g:d:' OPTION ; do
case "$OPTION" in
k) KEY=$OPTARG;;
g) GIT_URL=$OPTARG;;
d) DEPLOY_DIR=$OPTARG;;
*) echo "Unknown parameter"
esac
done
echo "-----------------------------"
echo "Key: ${KEY}"
echo "Git-Url: ${GIT_URL}"
echo "Deploy-Dir: ${DEPLOY_DIR}"
echo "----------------------------"
rm -Rf /tmp/git-deploy
ssh-agent bash -c "ssh-add ${KEY}; git clone ${GIT_URL} /tmp/git-deploy"
rm -Rf /tmp/git-deploy/.git # Remove the Git Folder
# Empty the deploy-directory without deleting itself
rm -Rf ${DEPLOY_DIR}/.* 2> /dev/null
rm -Rf ${DEPLOY_DIR}/*
# Move the newly downloaded files to the deploy-folder
mv -fT /tmp/git-deploy ${DEPLOY_DIR}