1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jitsi_ynh.git synced 2024-09-03 19:35:57 +02:00
jitsi_ynh/scripts/remove

91 lines
3.2 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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-videobridge" >/dev/null; then
yunohost service remove "$app-videobridge"
fi
if ynh_exec_warn_less yunohost service status "$app-jicofo" >/dev/null; then
yunohost service remove "$app-jicofo"
fi
# Remove the dedicated systemd config
ynh_remove_systemd_config --service="$app-videobridge"
ynh_remove_systemd_config --service="$app-jicofo"
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# RECONFIGURE PROSODY
#=================================================
ynh_script_progression --message="Reconfiguring Prosody..." --weight=1
prosodyctl deluser "$focus_user@auth.$domain" || true
prosodyctl deluser "$videobridge_user@auth.$domain" || true
# Remove domain conf template
ynh_secure_remove --file="/etc/prosody/conf.d/$domain.cfg.lua"
ynh_secure_remove --file="/etc/prosody/conf.avail/$domain.cfg.lua"
ynh_secure_remove --file="/etc/prosody/certs/$domain.key"
ynh_secure_remove --file="/etc/prosody/certs/$domain.crt"
ynh_secure_remove --file="/var/lib/prosody/$domain.key"
ynh_secure_remove --file="/var/lib/prosody/$domain.crt"
ynh_secure_remove --file="/var/lib/prosody/$domain.cnf"
ynh_secure_remove --file="/etc/prosody/certs/auth.$domain.key"
ynh_secure_remove --file="/etc/prosody/certs/auth.$domain.crt"
ynh_secure_remove --file="/var/lib/prosody/auth.$domain.key"
ynh_secure_remove --file="/var/lib/prosody/auth.$domain.crt"
ynh_secure_remove --file="/var/lib/prosody/auth.$domain.cnf"
ynh_secure_remove --file="/usr/local/share/ca-certificates/auth.$domain.crt"
update-ca-certificates -f
gpasswd --delete prosody "$app"
ynh_systemd_action --service_name=prosody --action=restart
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
ynh_app_setting_delete --app="$app" --key=require_prosody
ynh_remove_apps
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove a directory securely
ynh_secure_remove --file="/etc/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last