From 677ac040d3c88c0c2d6360b3d4f04f78f2345f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 31 Aug 2024 10:31:29 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/backup | 8 -------- scripts/install | 22 ---------------------- scripts/remove | 3 --- scripts/restore | 5 ----- scripts/upgrade | 42 ++---------------------------------------- 6 files changed, 3 insertions(+), 79 deletions(-) diff --git a/manifest.toml b/manifest.toml index 60c4be9..8a605ca 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ userdoc = "https://selfoss.aditu.de/" code = "https://github.com/fossar/selfoss" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = true diff --git a/scripts/backup b/scripts/backup index 01e65e1..d1eee1d 100755 --- a/scripts/backup +++ b/scripts/backup @@ -18,16 +18,8 @@ ynh_backup "$install_dir" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= - ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" -#================================================= -# BACKUP A CRON FILE -#================================================= - ynh_backup "/etc/cron.d/$app" #================================================= diff --git a/scripts/install b/scripts/install index 9ac415d..7568e84 100755 --- a/scripts/install +++ b/scripts/install @@ -3,28 +3,13 @@ source _common.sh source /usr/share/yunohost/helpers -#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | fpm_footprint="low" -#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | fpm_free_footprint=0 -#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | fpm_usage="low" - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - -#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint -#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint -#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Setting up source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/logs $install_dir/data/thumbnails $install_dir/data/sqlite $install_dir/public #================================================= @@ -32,10 +17,8 @@ chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/l #================================================= ynh_script_progression "Configuring PHP-FPM..." -# Create a dedicated PHP-FPM config ynh_config_add_phpfpm -# Create a dedicated NGINX config ynh_config_add_nginx #================================================= @@ -45,17 +28,12 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template="config.ini" --destination="$install_dir/config.ini" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.ini" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config.ini" - #================================================= # SETUP A CRON #================================================= ynh_script_progression "Setuping a cron..." ynh_config_add --template="cron" --destination="/etc/cron.d/$app" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 53bdd64..e4a3496 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,13 +8,10 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression "Removing NGINX web server configuration..." -# Remove the dedicated NGINX config ynh_config_remove_nginx -# Remove the dedicated PHP-FPM config ynh_config_remove_phpfpm -# Remove a cron file ynh_safe_rm "/etc/cron.d/$app" #================================================= diff --git a/scripts/restore b/scripts/restore index 074837b..1630076 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -23,8 +20,6 @@ ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/cron.d/$app" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM diff --git a/scripts/upgrade b/scripts/upgrade index 29842fe..0eb9dca 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,44 +3,13 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression "Ensuring downward compatibility..." - -# If fpm_footprint doesn't exist, create it -if [ -z "${fpm_footprint:-}" ]; then - fpm_footprint=low -#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --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 -#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --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 -#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage -fi - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression "Upgrading source files..." -# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed -if ynh_app_upstream_version_changed -then - ynh_script_progression "Upgrading source files..." +ynh_setup_source --dest_dir="$install_dir" --keep="data" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="data" -fi - -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/logs $install_dir/data/thumbnails $install_dir/data/sqlite $install_dir/public #================================================= @@ -48,10 +17,8 @@ chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/l #================================================= ynh_script_progression "Upgrading PHP-FPM configuration..." -# Create a dedicated PHP-FPM config ynh_config_add_phpfpm -# Create a dedicated NGINX config ynh_config_add_nginx #================================================= @@ -61,17 +28,12 @@ ynh_script_progression "Updating configuration..." ynh_config_add --template="config.ini" --destination="$install_dir/config.ini" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.ini" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config.ini" - #================================================= # SETUP A CRON #================================================= ynh_script_progression "Setuping a cron..." ynh_config_add --template="cron" --destination="/etc/cron.d/$app" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root: "/etc/cron.d/$app" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # END OF SCRIPT