From 4b02b0b1f59f2ff9c6e07246a8753dcabe97f105 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 28 Nov 2021 10:04:07 +0100 Subject: [PATCH] Upgrade to 4.3 --- conf/nginx.conf | 5 ----- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/install | 12 ++++++++++-- scripts/remove | 8 ++++++++ scripts/restore | 11 ++++++++--- scripts/upgrade | 9 ++++++++- 7 files changed, 36 insertions(+), 13 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d672a7c..1b3f784 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,11 +4,6 @@ location __PATH__/ { # Path to source alias __FINALPATH__/ ; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - rewrite ^/(__PATH__/img/.*)$ /$1 break; rewrite ^/(__PATH__/js/.*)$ /$1 break; rewrite ^/(__PATH__/style/.*)$ /$1 break; diff --git a/manifest.json b/manifest.json index 27d80f7..a78e248 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "email": "apulido@free.fr" }, "requirements": { - "yunohost": ">> 4.2.4" + "yunohost": ">> 4.3.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index b72bac6..f3e28de 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ YNH_PHP_VERSION="7.3" -extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-mbstring" +pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-mbstring" #php${YNH_PHP_VERSION}-mcrypt #================================================= diff --git a/scripts/install b/scripts/install index 20a63a3..7b585c3 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +phpversion=$YNH_PHP_VERSION #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -45,6 +46,14 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion + +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -82,8 +91,7 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +ynh_add_fpm_config #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index cf4f173..d517f24 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,14 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 6ec48ba..c38500e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -33,8 +33,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -71,7 +70,13 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -ynh_add_fpm_config --package="$extra_php_dependencies" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index f73c120..14b2f7e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -94,13 +94,20 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config #================================================= # GENERIC FINALIZATION