diff --git a/scripts/install b/scripts/install index 137f20c..1284f1d 100755 --- a/scripts/install +++ b/scripts/install @@ -38,6 +38,14 @@ chmod 644 "/etc/cron.d/$app" log_path="/var/log/$app" mkdir -p "$log_path" chown "$app":www-data "$log_path" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + # Use logrotate to manage application logfile(s) ynh_use_logrotate diff --git a/scripts/remove b/scripts/remove index 8b41faa..67760a8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,18 +16,46 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 + # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE PHP CONFIGURATION +#================================================= +ynh_script_progression --message="Removing PHP configuration..." --weight=1 + # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE CRON CONFIGURATION +#================================================= +ynh_script_progression --message="Removing Cron configuration..." --weight=1 + # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" +#================================================= +# REMOVE LOG FILES +#================================================= +ynh_script_progression --message="Removing log files..." --weight=1 + # Remove the log files ynh_secure_remove --file="/var/log/$app" +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index a07ccbf..28bda64 100644 --- a/scripts/restore +++ b/scripts/restore @@ -36,13 +36,34 @@ ynh_script_progression --message="Restoring system configurations related to $ap ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 + ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RESTORE THE CRON CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the Cron configuration..." --weight=1 + ynh_restore_file --origin_path="/etc/cron.d/$app" +#================================================= +# RESTORE THE LOG FILES +#================================================= +ynh_script_progression --message="Restoring the log files..." --weight=1 + log_path="/var/log/$app" mkdir -p "$log_path" chown "$app":www-data "$log_path" + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3b80d05..7acd057 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,16 +51,35 @@ chown -R "$app":www-data "$install_dir" #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +#================================================= +# PHP CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading PHP configuration..." + # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." + # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# CRON CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading Cron configuration..." + ynh_add_config --template="../conf/freshrss.cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +#================================================= +# LOG FILES +#================================================= + if [ -f /tmp/FreshRSS.log ]; then ynh_secure_remove --file="/tmp/FreshRSS.log" fi @@ -72,6 +91,12 @@ fi log_path="/var/log/$app" mkdir -p "$log_path" chown "$app":www-data "$log_path" + +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." + # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append