Remove directory if it already exists

This commit is contained in:
Bob Mottram 2018-03-31 13:46:34 +01:00
parent 7f89e7d87a
commit 55446a0bf8
2 changed files with 29 additions and 30 deletions

View File

@ -217,23 +217,22 @@ function install_bludit {
apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME" ]; then
mkdir "/var/www/$BLUDIT_DOMAIN_NAME"
if [ -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
rm -rf "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
if [ -d /repos/bludit ]; then
mkdir "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cp -r -p /repos/bludit/. "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 324687356
git pull
else
git_clone $BLUDIT_REPO "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
echo $'Unable to clone bludit repo'
exit 87525
fi
if [ -d /repos/bludit ]; then
mkdir "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cp -r -p /repos/bludit/. "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 324687356
git pull
else
git_clone $BLUDIT_REPO "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
echo $'Unable to clone bludit repo'
exit 87525
fi
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 36587356

View File

@ -593,27 +593,28 @@ if [[ "$app_php" == 'yes' ]]; then
echo ' apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl'
echo ''
fi
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME\" ]; then"
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME\""
echo " if [ -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; then"
echo " rm -rf \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
echo ' fi'
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; then"
echo " if [ -d /repos/${app_name} ]; then"
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
echo " if [ -d /repos/${app_name} ]; then"
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
if [ ! "$app_dir" ]; then
echo " cp -r -p /repos/${app_name}/. \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 324687356"
echo " cp -r -p /repos/${app_name}/. \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 324687356"
else
echo " cp -r -p /repos/${app_name}/. \"${app_dir}\""
echo " cd \"${app_dir}\" || exit 36487365"
echo " cp -r -p /repos/${app_name}/. \"${app_dir}\""
echo " cd \"${app_dir}\" || exit 36487365"
fi
echo ' git pull'
echo ' else'
echo ' git pull'
echo ' else'
if [ ! "$app_dir" ]; then
echo " git_clone \$${app_name_upper}_REPO \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
echo " git_clone \$${app_name_upper}_REPO \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
else
echo " git_clone \$${app_name_upper}_REPO \"${app_dir}\""
echo " git_clone \$${app_name_upper}_REPO \"${app_dir}\""
fi
echo ' fi'
echo ' fi'
echo ''
if [ ! "$app_dir" ]; then
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; then"
@ -623,7 +624,6 @@ fi
echo " echo \$'Unable to clone ${app_name} repo'"
echo ' exit 87525'
echo ' fi'
echo ' fi'
echo ''
if [ ! "$app_dir" ]; then
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 36587356"