From 8d2f1091d167bd5795e43e4d3bcf75c7bc3e6ccd Mon Sep 17 00:00:00 2001 From: Ric Harvey Date: Thu, 30 Jun 2016 11:30:40 +0100 Subject: [PATCH] Adding a check to stop pull of code if its already there --- scripts/start.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index dbca4f5..a6a605c 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -20,16 +20,19 @@ if [ ! -z "$GIT_NAME" ]; then git config --global push.default simple fi -# Pull down code from git for our site! -if [ ! -z "$GIT_REPO" ]; then - rm -Rf /var/www/html - mkdir /var/www/html - if [ ! -z "$GIT_BRANCH" ]; then - git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/ - else - git clone $GIT_REPO /var/www/html/ - fi - chown -Rf nginx.nginx /var/www/html +# Dont pull code down if the .git folder exists +if [ ! -d "/var/www/html/.git" ]; then + # Pull down code from git for our site! + if [ ! -z "$GIT_REPO" ]; then + # Remove the test index file + rm -Rf /var/www/html/index.php + if [ ! -z "$GIT_BRANCH" ]; then + git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/ + else + git clone $GIT_REPO /var/www/html/ + fi + chown -Rf nginx.nginx /var/www/html + fi fi # Display PHP error's or not