From 038d520674ce9b5040a65ddca9806903c68a0c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:05:12 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/change_url | 2 -- scripts/install | 2 -- scripts/remove | 3 --- scripts/upgrade | 36 ++++++++++++++++++------------------ 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/manifest.toml b/manifest.toml index f241a37..4b0b613 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,7 @@ userdoc = "https://invoiceninja.github.io/" code = "https://github.com/invoiceninja/invoiceninja" [integration] -yunohost = ">= 11.2.29" +yunohost = ">= 11.2.30" helpers_version = "2.1" architectures = "all" multi_instance = true diff --git a/scripts/change_url b/scripts/change_url index 4c10194..0bce995 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -10,8 +10,6 @@ ynh_script_progression "Updating NGINX web server configuration..." ynh_config_change_url_nginx -#================================================= -# SPECIFIC MODIFICATIONS #================================================= # MODIFY A CONFIG FILE #================================================= diff --git a/scripts/install b/scripts/install index ac7bb1d..9b5e4e6 100755 --- a/scripts/install +++ b/scripts/install @@ -39,8 +39,6 @@ ynh_config_add_phpfpm ynh_config_add_nginx -#================================================= -# SPECIFIC SETUP #================================================= # MODIFY A CONFIG FILE #================================================= diff --git a/scripts/remove b/scripts/remove index 1ef10bf..9d4118b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -5,9 +5,6 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS -#================================================= -# REMOVE SYSTEMD SERVICE - #================================================= ynh_script_progression "Removing system configurations related to $app..." diff --git a/scripts/upgrade b/scripts/upgrade index 0f009ac..a58183e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,6 +3,24 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# ENSURE BACKWARD COMPATIBILITY +#================================================= +ynh_script_progression "Ensuring backward compatibility..." + +# Delete deprecated `firstname`/`lastname` settings. See upstream https://github.com/YunoHost/yunohost/pull/1516 +ynh_app_setting_delete --key=email_firstname +ynh_app_setting_delete --key=email_lastname +ynh_app_setting_delete --key=email # also delete unnecessary duplicate of state storage + +# Retrieve `$admin` user settings +ynh_app_setting_set_default --key=email_fullname --value="$(ynh_user_get_info --username=$admin --key=fullname)" +ynh_app_setting_set_default --key=email --value="$(ynh_user_get_info --username=$admin --key=mail)" + +ynh_app_setting_set_default --key=api_secret --value="$(ynh_string_random --length=32)" +ynh_app_setting_set_default --key=app_key --value="$(ynh_string_random --length=32)" +ynh_app_setting_set_default --key=phantomjs_key --value="$(ynh_string_random --length=32)" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -21,24 +39,6 @@ ynh_config_add_nginx ynh_config_add --template="cron" --destination="/etc/cron.d/$app" -#================================================= -# ENSURE BACKWARD COMPATIBILITY -#================================================= -ynh_script_progression "Ensuring backward compatibility..." - -# Delete deprecated `firstname`/`lastname` settings. See upstream https://github.com/YunoHost/yunohost/pull/1516 -ynh_app_setting_delete --key=email_firstname -ynh_app_setting_delete --key=email_lastname -ynh_app_setting_delete --key=email # also delete unnecessary duplicate of state storage - -# Retrieve `$admin` user settings -email_fullname="$(ynh_user_get_info --username=$admin --key=fullname)" -email="$(ynh_user_get_info --username=$admin --key=mail)" - -api_secret="$(ynh_string_random --length=32)" -app_key="$(ynh_string_random --length=32)" -phantomjs_key="$(ynh_string_random --length=32)" - #================================================= # UPDATE A CONFIG FILE #=================================================