From b870da0d97170fb68487747d516330960f8f01ec Mon Sep 17 00:00:00 2001 From: Krakinou Date: Thu, 18 Apr 2019 22:17:43 +0200 Subject: [PATCH] copy from example --- conf/nginx.conf | 2 +- scripts/install | 2 + scripts/remove | 102 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 95 insertions(+), 11 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index fd17daa..6853de3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -14,7 +14,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/scripts/install b/scripts/install index abe9217..a0cec7d 100644 --- a/scripts/install +++ b/scripts/install @@ -136,6 +136,8 @@ chmod 644 /etc/cron.d/$app # Create a dedicated nginx config ynh_add_nginx_config +ynh_add_fpm_config + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index 2569dc0..57fe260 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,28 +1,110 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + source _common.sh source /usr/share/yunohost/helpers +#================================================= +# LOAD SETTINGS +#================================================= +ynh_print_info --message="Loading installation settings..." -db_name=$(ynh_app_setting_get $app db_name) -db_user==$db_name +app=$YNH_APP_INSTANCE_NAME -#remove php-geoip +domain=$(ynh_app_setting_get --app=$app --key=domain) +port=$(ynh_app_setting_get --app=$app --key=port) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + + + +#================================================= +# REMOVE THE MYSQL DATABASE +#================================================= +ynh_print_info --message="Removing the MySQL database" + +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name + + + +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_print_info --message="Removing dependencies" + +# Remove metapackage and its dependencies ynh_remove_app_dependencies -#removing emailpoubelle database -ynh_mysql_remove_db $db_user $db_name -#removing emailpoubelle directory -ynh_secure_remove /var/www/$app -#removing nginx conf + + + +#================================================= +# REMOVE APP MAIN DIR +#================================================= +ynh_print_info --message="Removing app main directory" + +# Remove the app directory securely +ynh_secure_remove --file="$final_path" + + +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= +ynh_print_info --message="Removing nginx web server configuration" + +# Remove the dedicated nginx config ynh_remove_nginx_config + +#================================================= +# REMOVE PHP-FPM CONFIGURATION +#================================================= +ynh_print_info --message="Removing php-fpm configuration" + +# Remove the dedicated php-fpm config +ynh_remove_fpm_config + + +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE THE CRON FILE +#================================================= + +# Remove a cron file +ynh_secure_remove --file="/etc/cron.d/$app" + +# Remove a directory securely +ynh_secure_remove --file="/etc/$app/" + +# Remove the log files +ynh_secure_remove --file="/var/log/$app/" + + +#================================================= #removing aliases +#================================================= ynh_replace_string "/devnull:\/dev\/null/d" /etc/aliases newaliases # Remove hook for postfix conf ynh_secure_remove "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" -#remove cronjob -rm -f /etc/cron.d/emailpoubelle +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= +ynh_print_info --message="Removing the dedicated system user" + +# Delete a system user +ynh_system_user_delete --username=$app + + yunohost service regen-conf postfix service nginx reload yunohost app ssowatconf