From 7535c70c8a7f047647e34a02cbb18dd0e4fe379e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 7 Jun 2023 00:54:58 +0200 Subject: [PATCH] fix --- scripts/install | 12 +++++------- scripts/remove | 2 -- scripts/restore | 16 ++++++++-------- scripts/upgrade | 2 -- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/scripts/install b/scripts/install index 19f6def..c4f6723 100644 --- a/scripts/install +++ b/scripts/install @@ -61,6 +61,9 @@ ynh_app_setting_set --app=$app --key=allow_public_rooms --value=$allow_public_ro ynh_app_setting_set --app=$app --key=e2e_enabled_by_default --value=$e2e_enabled_by_default ynh_app_setting_set --app=$app --key=synapse_user_app_pwd --value=$synapse_user_app_pwd +ynh_app_setting_set --app=$app --key=synapse_user --value=$synapse_user +ynh_app_setting_set --app=$app --key=final_www_path --value=$final_www_path + #================================================= # CREATE A DH FILE #================================================= @@ -154,11 +157,9 @@ ynh_app_setting_set --app=$app --key=macaroon_secret_key --value="$macaroon_secr ynh_script_progression --message="Configuring a systemd service..." --weight=2 # Create systemd service for Synapse and Turnserver -#cp ../conf/default_matrix-synapse /etc/default/matrix-$app ynh_add_config --template="../conf/default_matrix-synapse" --destination="/etc/default/matrix-$app" ynh_add_systemd_config --service=matrix-$app --template=matrix-synapse.service -#cp ../conf/default_coturn /etc/default/coturn-$app ynh_add_config --template="../conf/default_coturn" --destination="/etc/default/coturn-$app" ynh_add_systemd_config --service=coturn-$app --template=coturn-synapse.service @@ -175,8 +176,8 @@ then ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" fi -# Create a dedicated nginx config -ynh_add_nginx_config #app +# Create a dedicated NGINX config +ynh_add_nginx_config #================================================= # SET SYNAPSE CONFIG @@ -305,9 +306,6 @@ ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Syn #================================================= ynh_script_progression --message="Configuring Fail2Ban..." --weight=10 -# WARNING : theses command are used in INSTALL, UPGRADE -# For any update do it in all files - ynh_add_fail2ban_config --use_template #================================================= diff --git a/scripts/remove b/scripts/remove index d78a4da..f8123cf 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,9 +14,7 @@ source /usr/share/yunohost/helpers # SET CONSTANTS #================================================= -synapse_user="matrix-$app" upstream_version=$(ynh_app_upstream_version) -final_www_path="/var/www/$app" #================================================= # REMOVE SYSTEM CONFIGURATIONS diff --git a/scripts/restore b/scripts/restore index ab31dc1..365f8e9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -22,10 +22,7 @@ main_domain=$(yunohost domain list --output-as json | jq -r .main) # SET ALL CONSTANT #================================================= -synapse_user="matrix-$app" -synapse_user_app="$app" upstream_version=$(ynh_app_upstream_version) -final_www_path="/var/www/$app" #================================================= # RECREATE THE DEDICATED USER @@ -37,11 +34,14 @@ ynh_system_user_create --username=$synapse_user --home_dir=$install_dir # The format to create an user account varies depending on the version of YunoHost currently installed. ynh_current_version=$(dpkg-query --showformat='${Version}' --show yunohost) -if $(dpkg --compare-versions "$ynh_current_version" ge "11.1"); then - yunohost user create $synapse_user_app -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd" -else - yunohost user create $synapse_user_app -f Synapse -l Application -d $domain -p "$synapse_user_app_pwd" -fi +#if $(dpkg --compare-versions "$ynh_current_version" ge "11.1"); then +# yunohost user create $app -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd" +#else +# yunohost user create $app -f Synapse -l Application -d $domain -p "$synapse_user_app_pwd" +#fi + +ynh_system_user_create --username=$synapse_user + adduser $synapse_user ssl-cert adduser turnserver ssl-cert diff --git a/scripts/upgrade b/scripts/upgrade index e295d28..2406ff9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,10 +23,8 @@ main_domain=$(yunohost domain list --output-as json | jq -r .main) # SET ALL CONSTANT #================================================= -synapse_user="matrix-$app" upstream_version=$(ynh_app_upstream_version) upgrade_type=$(ynh_check_app_version_changed) -final_www_path="/var/www/$app" #================================================= # ENSURE DOWNWARD COMPATIBILITY