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,10 +217,10 @@ 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"
@ -234,7 +234,6 @@ function install_bludit {
echo $'Unable to clone bludit repo'
exit 87525
fi
fi
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 36587356
git checkout $BLUDIT_COMMIT -b $BLUDIT_COMMIT

View File

@ -593,10 +593,11 @@ 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\""
if [ ! "$app_dir" ]; 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"