From 78cdc47d289f71e252af4a5d3ea351f0a74f5435 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Fri, 10 Mar 2017 15:35:27 +0100 Subject: [PATCH] =?UTF-8?q?V=C3=A9rifier=20les=20fichiers=20de=20conf=20et?= =?UTF-8?q?=20le=20r=C3=A9pertoire=20final=5Fpath=20lors=20du=20restore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/restore | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/scripts/restore b/scripts/restore index c2c19f1..27d3152 100644 --- a/scripts/restore +++ b/scripts/restore @@ -20,22 +20,29 @@ with_mysql=$(ynh_app_setting_get "$app" with_mysql) sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" +# Check $final_path +final_path="/var/www/${app}" +if [ -d $final_path ]; then + ynh_die "There is already a directory: $final_path" +fi + +# Check configuration files nginx +nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" +if [ -f $nginx_conf ]; then + ynh_die "The NGINX configuration already exists at '${nginx_conf}'. You should safely delete it before restoring this app." + # Check configuration files php-fpm -# nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" -# [[ -f $nginx_conf ]] && ynh_die \ -# "The NGINX configuration already exists at '${nginx_conf}'. -# You should safely delete it before restoring this app." -# phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" -# [[ -f $phpfpm_conf ]] && ynh_die \ -# "The PHP FPM configuration already exists at '${phpfpm_conf}'. -# You should safely delete it before restoring this app." -# phpfpm_ini="/etc/php5/fpm/conf.d/20-${app}.ini" -# [[ -f $phpfpm_ini ]] && ynh_die \ -# "The PHP FPM INI configuration already exists at '${phpfpm_ini}'. -# You should safely delete it before restoring this app." +phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" +if [ -f $phpfpm_conf ]; then + ynh_die "The PHP FPM configuration already exists at '${phpfpm_conf}'. You should safely delete it before restoring this app." +fi + +phpfpm_ini="/etc/php5/fpm/conf.d/20-${app}.ini" +if [ -f $phpfpm_ini ]; then + ynh_die "The PHP FPM INI configuration already exists at '${phpfpm_ini}'. You should safely delete it before restoring this app." +fi # Restore sources & data -final_path="/var/www/${app}" sudo cp -a ./sources "$final_path" # Set permissions