1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse-admin_ynh.git synced 2024-09-03 20:26:34 +02:00
This commit is contained in:
Alexandre Aubin 2024-04-16 18:19:27 +02:00
parent 85d12a7fdb
commit 754693b325
4 changed files with 20 additions and 12 deletions

View file

@ -1,19 +1,21 @@
#!/bin/bash #!/bin/bash
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=port_synapse)
if [[ -z "$synapse_port" ]]
then
# The setting was synapse_port in older versions of the app
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
if [[ -z "$synapse_port" ]]
ynh_die --message="Unable to find synapse port ?!"
fi
fi
_add_synapse_endpoint_nginx_config() { _add_synapse_endpoint_nginx_config() {
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=port_synapse)
if [[ -z "$synapse_port" ]]
then
# The setting was synapse_port in older versions of the app
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
if [[ -z "$synapse_port" ]]
then
ynh_die --message="Unable to find synapse port ?!"
fi
fi
# In case the domain changed for some reason # In case the domain changed for some reason
old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf)" old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf 2>/dev/null)"
for FILE in $old_endpoint_confs_for_this_app for FILE in $old_endpoint_confs_for_this_app
do do
ynh_delete_file_checksum --file="$FILE" ynh_delete_file_checksum --file="$FILE"

View file

@ -24,6 +24,8 @@ ynh_backup --src_path="$install_dir"
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"

View file

@ -9,6 +9,8 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================

View file

@ -24,6 +24,8 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"