From fb91137a825e4c21fd843f811b6b09bc2815ffea Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 7 Feb 2017 18:04:00 +0100 Subject: [PATCH 1/5] [enh] Update remove MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Suppression sécurisée de $final_path, ce serait bête un `sudo rm -rf /var/www/` - Et toujours php-fpm par défaut... --- scripts/remove | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 59ef331..1d8df2c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,15 +10,19 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get "$app" domain) # Remove sources -sudo rm -rf /var/www/$app +if test -z "$app" || [ "$app" = "/" ]; then + echo "Variable app is empty, suppression of app directory cancelled." >&2 +else + sudo rm -rf /var/www/$app +fi # Remove nginx configuration file sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf ### PHP (remove if not used) ### # If a dedicated php-fpm process is used: -# sudo rm -f /etc/php5/fpm/pool.d/$app.conf -# sudo service php5-fpm reload +sudo rm -f /etc/php5/fpm/pool.d/$app.conf +sudo service php5-fpm reload ### PHP end ### ### MySQL (remove if not used) ### From d27171a82abed6f2f6141c4c7160154ebe2febdf Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 8 Feb 2017 11:03:00 +0100 Subject: [PATCH 2/5] [fix] Reload nginx just after removing nginx conf --- scripts/remove | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/remove b/scripts/remove index 1d8df2c..4e1c915 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,14 +10,19 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get "$app" domain) # Remove sources -if test -z "$app" || [ "$app" = "/" ]; then - echo "Variable app is empty, suppression of app directory cancelled." >&2 +# Avoid removing important directory if $app is empty or equal to +# "/" "/var" "/var/www" "/opt" "/home" "/home/yunohost.app" +src_path=/var/www/$app +if test -z "$src_path" || [ "/var/www /opt /home/yunohost.app" =~ $src_path ]; then + echo "Variable src_path seems incomplete, suppression of app directory cancelled." >&2 else - sudo rm -rf /var/www/$app + sudo rm -rf $src_path fi # Remove nginx configuration file sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf +# Reload nginx service +sudo service nginx reload ### PHP (remove if not used) ### # If a dedicated php-fpm process is used: @@ -34,5 +39,3 @@ sudo service php5-fpm reload # ynh_mysql_drop_user "$dbuser" || true ### MySQL end ### -# Reload nginx service -sudo service nginx reload From 7d8075d5a04de474913b40199b51fdb8d7b67f53 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 8 Feb 2017 11:09:33 +0100 Subject: [PATCH 3/5] Check if $app is empty src_path equal to /var/www/$app, so it can't be empty. Even if app is empty, src_path can never be empty. --- scripts/remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index 4e1c915..83c2f40 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,10 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get "$app" domain) # Remove sources -# Avoid removing important directory if $app is empty or equal to +# Avoid removing important directory if $app is empty or $src_path equal to # "/" "/var" "/var/www" "/opt" "/home" "/home/yunohost.app" src_path=/var/www/$app -if test -z "$src_path" || [ "/var/www /opt /home/yunohost.app" =~ $src_path ]; then +if test -z "$app" || [ "/var/www /opt /home/yunohost.app" =~ $src_path ]; then echo "Variable src_path seems incomplete, suppression of app directory cancelled." >&2 else sudo rm -rf $src_path From 500ca9ed10fa949ae4094f2380c93cfeae495345 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Sun, 26 Mar 2017 20:10:49 +0200 Subject: [PATCH 4/5] [fix] typo --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 83c2f40..42f2155 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,7 +14,7 @@ domain=$(ynh_app_setting_get "$app" domain) # "/" "/var" "/var/www" "/opt" "/home" "/home/yunohost.app" src_path=/var/www/$app if test -z "$app" || [ "/var/www /opt /home/yunohost.app" =~ $src_path ]; then - echo "Variable src_path seems incomplete, suppression of app directory cancelled." >&2 + echo "Variable src_path seems uncomplete, deletion of app directory cancelled." >&2 else sudo rm -rf $src_path fi From 8a2715dabdb3e8327c736360b71396e70c45b948 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Sun, 26 Mar 2017 23:10:01 +0200 Subject: [PATCH 5/5] [fix] typo again --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 42f2155..df1c5ca 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,7 +14,7 @@ domain=$(ynh_app_setting_get "$app" domain) # "/" "/var" "/var/www" "/opt" "/home" "/home/yunohost.app" src_path=/var/www/$app if test -z "$app" || [ "/var/www /opt /home/yunohost.app" =~ $src_path ]; then - echo "Variable src_path seems uncomplete, deletion of app directory cancelled." >&2 + echo "Variable src_path seems incomplete, deletion of app directory cancelled." >&2 else sudo rm -rf $src_path fi