From c8fc90d771122fccd2612ab186745b173bc1587c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 3 Oct 2023 13:52:00 +0200 Subject: [PATCH] Cleanup, cosmetics --- scripts/change_url | 4 +++- scripts/install | 14 ++++---------- scripts/remove | 9 ++------- scripts/restore | 20 ++++---------------- scripts/upgrade | 15 +++++---------- 5 files changed, 18 insertions(+), 44 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 4ba8cf7..d50c1a8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,10 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 ynh_change_url_nginx_config diff --git a/scripts/install b/scripts/install index 4c348f5..3ec041a 100755 --- a/scripts/install +++ b/scripts/install @@ -32,24 +32,18 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= -# PHP-FPM CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 - -ynh_add_fpm_config --usage="$fpm_usage" --footprint="$fpm_footprint" - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_add_nginx_config +ynh_add_fpm_config --usage="$fpm_usage" --footprint="$fpm_footprint" + #================================================= # CREATE DATA DIRECTORY #================================================= diff --git a/scripts/remove b/scripts/remove index cd3d61d..a6a8ac5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,17 +10,12 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# REMOVE NGINX CONFIGURATION +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 - ynh_remove_fpm_config #================================================= diff --git a/scripts/restore b/scripts/restore index 29c368e..6fe4e39 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,14 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -25,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" @@ -36,20 +27,17 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$data_dir" --not_mandatory -# this will be treated as a security issue. -chmod 750 "$data_dir" chmod -R o-rwx "$data_dir" chown -R "$app:www-data" "$data_dir" #================================================= -# RESTORE THE PHP-FPM CONFIGURATION +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --usage="$fpm_usage" --footprint="$fpm_footprint" --phpversion="$phpversion" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # GENERIC FINALIZATION @@ -59,7 +47,7 @@ ynh_add_fpm_config --usage="$fpm_usage" --footprint="$fpm_footprint" --phpversio ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="nginx" --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 02da7a8..8fdafef 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,22 +67,17 @@ fi chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= -# PHP-FPM CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 - -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_add_nginx_config +ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint + #================================================= # END OF SCRIPT #=================================================