2021-05-10 15:15:42 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
|
2022-01-24 23:05:47 +01:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
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"
|
2022-01-24 23:05:47 +01:00
|
|
|
fi
|
|
|
|
|
2022-02-26 23:03:46 +01:00
|
|
|
# If synapse_app doesn't exist, create it and assume it is `synapse`
|
2024-04-16 17:56:48 +02:00
|
|
|
if [ -z "${synapse_app:-}" ]; then
|
2024-01-07 20:58:17 +01:00
|
|
|
synapse_app="synapse"
|
|
|
|
ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app
|
2022-02-26 23:03:46 +01:00
|
|
|
fi
|
|
|
|
|
2023-04-10 17:39:53 +02:00
|
|
|
# Delete service and nodejs dependencies
|
2024-01-07 20:58:17 +01:00
|
|
|
if ynh_compare_current_package_version --comparison lt --version 0.8.7~ynh1; then
|
|
|
|
yunohost service remove $app
|
|
|
|
ynh_remove_systemd_config
|
2023-04-10 17:39:53 +02:00
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
ynh_remove_nodejs
|
|
|
|
ynh_remove_logrotate
|
2022-02-26 22:44:20 +01:00
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
ynh_app_setting_delete --app=$app --key=synapse_port
|
|
|
|
ynh_app_setting_delete --app=$app --key=port
|
|
|
|
fi
|
2021-08-06 20:11:14 +02:00
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
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
|
2021-08-06 20:11:14 +02:00
|
|
|
|
2021-05-10 15:15:42 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=2
|
2021-05-10 15:15:42 +02:00
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2021-05-10 15:15:42 +02:00
|
|
|
fi
|
|
|
|
|
2024-01-07 20:58:17 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-08-06 20:11:14 +02:00
|
|
|
|
2021-05-10 15:15:42 +02:00
|
|
|
#=================================================
|
2024-01-07 20:58:17 +01:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2021-05-10 15:15:42 +02:00
|
|
|
#=================================================
|
2024-01-07 20:58:17 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
2021-05-10 15:15:42 +02:00
|
|
|
|
|
|
|
# Create a dedicated nginx config
|
|
|
|
ynh_add_nginx_config
|
2024-04-16 17:56:48 +02:00
|
|
|
_add_synapse_endpoint_nginx_config
|
2022-02-26 22:44:20 +01:00
|
|
|
|
2021-05-10 15:15:42 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|