mirror of
https://github.com/YunoHost-Apps/mautrix_facebook_ynh.git
synced 2024-09-03 19:36:33 +02:00
73 lines
3 KiB
Bash
Executable file
73 lines
3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
|
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
|
|
|
#REMOVEME? botname=$(ynh_app_setting_get --app=$app --key=botname)
|
|
#REMOVEME? synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
|
#REMOVEME? server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
#REMOVEME? db_user=$db_name
|
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
|
#REMOVEME? synapse_registration_path=$(ynh_app_setting_get --app=$app --key=synapse_registration_path)
|
|
synapse_db_name="matrix_$synapse_instance"
|
|
|
|
#=================================================
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
|
yunohost service remove "$app"
|
|
fi
|
|
|
|
# Remove the dedicated systemd config
|
|
ynh_remove_systemd_config
|
|
|
|
# Remove the app-specific logrotate config
|
|
ynh_remove_logrotate
|
|
|
|
#=================================================
|
|
# REMOVE THE POSTGRESQL DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Removing the PostgreSQL configuration..." --weight=4
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
ynh_psql_execute_as_root --database="$synapse_db_name" --sql="DROP OWNED BY ""$app"";"
|
|
ynh_psql_execute_as_root --database="$synapse_db_name" --sql="DROP USER ""$app"";"
|
|
ynh_psql_execute_as_root --database="$synapse_db_name" --sql="DROP OWNED BY ""$botname"";"
|
|
ynh_psql_execute_as_root --database="$synapse_db_name" --sql="DROP USER ""$botname"";"
|
|
|
|
#=================================================
|
|
# SPECIFIC REMOVE
|
|
#=================================================
|
|
# REMOVE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Removing various files..." --weight=6
|
|
|
|
# Remove a directory securely
|
|
ynh_secure_remove --file="$synapse_registration_path/$app.yaml"
|
|
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die --message="Synapse can't restart with the appservice configuration"
|
|
|
|
# Remove the log files
|
|
ynh_secure_remove --file="/var/log/$app"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|