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 php-gettext php-curl php-gd php-mysql git curl
apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
if [ ! -d "/var/www/$BLUDIT_DOMAIN_NAME" ]; then if [ -d "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" ]; then
mkdir "/var/www/$BLUDIT_DOMAIN_NAME" rm -rf "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi 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 if [ -d /repos/bludit ]; then
echo $'Unable to clone bludit repo' mkdir "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
exit 87525 cp -r -p /repos/bludit/. "/var/www/$BLUDIT_DOMAIN_NAME/htdocs"
fi 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 fi
cd "/var/www/$BLUDIT_DOMAIN_NAME/htdocs" || exit 36587356 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 ' apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl'
echo '' echo ''
fi 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 ' fi'
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; then"
echo " if [ -d /repos/${app_name} ]; then" echo " if [ -d /repos/${app_name} ]; then"
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\"" echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " cp -r -p /repos/${app_name}/. \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\"" 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 " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 324687356"
else else
echo " cp -r -p /repos/${app_name}/. \"${app_dir}\"" echo " cp -r -p /repos/${app_name}/. \"${app_dir}\""
echo " cd \"${app_dir}\" || exit 36487365" echo " cd \"${app_dir}\" || exit 36487365"
fi fi
echo ' git pull' echo ' git pull'
echo ' else' echo ' else'
if [ ! "$app_dir" ]; then 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 else
echo " git_clone \$${app_name_upper}_REPO \"${app_dir}\"" echo " git_clone \$${app_name_upper}_REPO \"${app_dir}\""
fi fi
echo ' fi' echo ' fi'
echo '' echo ''
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " if [ ! -d \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" ]; 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 " echo \$'Unable to clone ${app_name} repo'"
echo ' exit 87525' echo ' exit 87525'
echo ' fi' echo ' fi'
echo ' fi'
echo '' echo ''
if [ ! "$app_dir" ]; then if [ ! "$app_dir" ]; then
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 36587356" echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 36587356"