#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if ynh_compare_current_package_version --comparison le --version 0.8.3~ynh2; then ynh_die --message="Upgrade from version 0.8.3 is not possible. You must uninstall and reinstall Synapse-admin package manually" fi # If synapse_app doesn't exist, create it and assume it is `synapse` if [ -z "$synapse_app" ]; then synapse_app="synapse" ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app fi # Delete service and nodejs dependencies if ynh_compare_current_package_version --comparison lt --version 0.8.7~ynh1; then yunohost service remove $app ynh_remove_systemd_config ynh_remove_nodejs ynh_remove_logrotate ynh_app_setting_delete --app=$app --key=synapse_port ynh_app_setting_delete --app=$app --key=port fi if ynh_compare_current_package_version --comparison lt --version 0.8.7~ynh3; then ynh_app_setting_delete --app=$app --key=synapse_domain ynh_app_setting_delete --app=$app --key=synapse_port fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ]; then ynh_script_progression --message="Upgrading source files..." --weight=2 ynh_setup_source --dest_dir="$install_dir" fi chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # UPDATE SYNAPSE ENDPOINT #================================================= ynh_script_progression --message="Updating NGINX web server configuration for Synapse..." --weight=2 _update_synapse_nginx_config #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config # Create NGINX config to access /_synapse/admin endpoint synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last