From 6e16bef0c0907b0dc26eba3b20b6a6a5c36784b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 16 May 2023 09:54:15 +0200 Subject: [PATCH] cleaning --- CHANGELOG.md | 112 ------------------------------------------------ scripts/install | 27 ++++++++---- scripts/remove | 12 +----- scripts/restore | 22 +++------- scripts/upgrade | 31 +++++++++----- 5 files changed, 47 insertions(+), 157 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 79fd231..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,112 +0,0 @@ -# Changelog - -## [Unreleased] - -## [2018-04-22a~ynhXX] - -### Added - -- Upgrade actions and config-panel scripts - ------------- - -# [2022.07.31a~ynh2] - 2023-02-XX - -## Changed - -- Apply "default package recommandation" for "example_ynh" package and "YunoHost apps teams" -- Use helper `ynh_add_config` for the uprgade script too (fix linter warning) - -### Fixed - -- Bug in upgrade script not writing the php configuration to the right location (and breaking the backup later if DokuWiki has been installed for the for the first time with version `2022.07.31a~ynh1`) - - -# [2022.07.31a~ynh1] - 2022-09-XX - -## Added - -- New DokuWiki version `2022-07-31a "Igor"` with **Hotfix 2022-07-31a** -- New automated tests for "check_process" CI - -## Changed - -- Use PHP8.1 as default (PHP7.4 is bulleyes will be EOL "28 Nov 2022" so bump the version) -- Change method to "automatic upgrade" of plugins -- Cleanning 'admin permission' handling -- redo how php is managed: ynh_add_fpm_config + php config files -- Sync with reference package 'example_ynh' - -## Removed - -- automatic installation of plugin "logautherror" (not compatible) -- support for YunoHost below 11 (no time to test against older versions) - -# [2020-07-29~ynh4] - 2021-01-19 - -### Added - -- Support for new permission system in YunoHost 3.7 - -### Changed - -- wiki administrators is now a group and can be modified from webadmin YunoHost panel -- Require YunoHost 3.7 minimum - -## [2020-07-29~ynh2] - 2020-10-23 - -### Added - -- New DokuWiki version `2020-07-29` - -### Changed - -- Set PHP7.3 as default - -## [2018-04-22b~ynh1] - 2020-03-23 - -### Added - -- New DokuWiki version `2018-04-22b` -- Changelog available in `CHANGELOG.md` - -### Changed - -- Upgrade content of file `pull_request_template.md` - -## [2018-04-22a~ynh3] - 2020-02-20 - -### Added - -- Use 'URL rewrite' for prettier URLs - -### Changed - -- Activate URL rewrite by default (does not break old links) - -### Removed - -- Unused DokuWiki config file - -## [2018-04-22a~ynh2] - 2020-02-20 - -### Added - -- Add fail2ban support to avoid bruteforce login attempts - -### Changed - -- Global upgrade of the package - -### Fixed - -- Get rid of the php ini file and merge its content into the pool file -- Update Readme following last work made on the package and current version in testing branch - -### Removed - -- Unused config file settings - -## [Previous versions] - YYYY-MM-DD - -- Will be written (one day maybye) diff --git a/scripts/install b/scripts/install index c490497..5440773 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,22 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# RETRIEVE ARGUMENTS FROM THE MANIFEST +#================================================= + +fpm_footprint="low" +fpm_free_footprint=0 +fpm_usage="low" + +#================================================= +# STORE SETTINGS FROM MANIFEST +#================================================= + +ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -21,17 +37,12 @@ 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=2 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint # Create a dedicated NGINX config ynh_add_nginx_config diff --git a/scripts/remove b/scripts/remove index ee70c9f..19a8599 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,24 +12,14 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 - # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=7 - # Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index f9cc354..75e684f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,28 +21,18 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# RESTORE FAIL2BAN CONFIGURATION +# RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=7 +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" + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=5 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f89198f..ca22984 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,24 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# If fpm_footprint doesn't exist, create it +if [ -z "${fpm_footprint:-}" ]; then + fpm_footprint=low + ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +fi + +# If fpm_free_footprint doesn't exist, create it +if [ -z "${fpm_free_footprint:-}" ]; then + fpm_free_footprint=0 + ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +fi + +# If fpm_usage doesn't exist, create it +if [ -z "${fpm_usage:-}" ]; then + fpm_usage=low + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +fi + # Yunohost specific configuration, if it isn't exist already # Previously, these settings were store in an unique "dokuwiki.php" @@ -118,17 +136,12 @@ chmod -R o-rwx "$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_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint # Create a dedicated NGINX config ynh_add_nginx_config @@ -210,8 +223,6 @@ fi else ynh_print_warn --message="Automatic plugin cannot be done, you have to upgrade them from your DokuWiki admin panel." fi - - fi #=================================================