From 42266257735a64db2f9cfd5238194d4424bf539f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 14 Jan 2024 12:39:55 +0100 Subject: [PATCH] fix --- scripts/backup | 10 +++------- scripts/change_url | 4 ++-- scripts/restore | 6 +++--- scripts/upgrade | 42 +++++------------------------------------- 4 files changed, 13 insertions(+), 49 deletions(-) diff --git a/scripts/backup b/scripts/backup index 05a273a..9e2ef0a 100644 --- a/scripts/backup +++ b/scripts/backup @@ -21,17 +21,13 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index bd1543f..2f93da1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_change_url_nginx_config @@ -22,5 +22,5 @@ ynh_change_url_nginx_config # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/restore b/scripts/restore index ecec1d8..b53fa02 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,17 +17,17 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - 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" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1dcd250..6b9913a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,55 +9,23 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Test because file doesn’t exist at first install. It is created at first page opening. - if test -f "$install_dir/inc/digiwords.db" - then - # Create a temporary directory - tmpdir="$(mktemp -d)" - - # Backup the inc/digiwords.db file to the temp dir - cp -ar "$install_dir/inc/digiwords.db" "$tmpdir/digiwords.db" - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --full_replace=1 - - # Copy digiwords.db back to the install_dir - cp -ar "$tmpdir/digiwords.db" "$install_dir/inc/digiwords.db" - - # Remove the tmp directory securely - ynh_secure_remove --file="$tmpdir" - else - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --full_replace=1 - fi -fi +ynh_setup_source --dest_dir="$install_dir" --keep="inc/digiwords.db" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -# Create a dedicated NGINX config ynh_add_nginx_config -# Create a dedicated PHP-FPM config ynh_add_fpm_config #=================================================