1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/funkwhale_ynh.git synced 2024-09-03 18:36:24 +02:00
funkwhale_ynh/scripts/remove

85 lines
2.8 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status "${app}-server" >/dev/null
then
ynh_script_progression "Removing ${app}-server service integration..."
yunohost service remove "${app}-server"
fi
if ynh_hide_warnings yunohost service status "${app}-worker" >/dev/null
then
ynh_script_progression "Removing ${app}-worker service integration..."
yunohost service remove "${app}-worker"
fi
if ynh_hide_warnings yunohost service status "${app}-beat" >/dev/null
then
ynh_script_progression "Removing ${app}-beat service integration..."
yunohost service remove "${app}-beat"
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression "Stopping and removing the systemd service..."
ynh_systemctl --service="${app}-beat" --action="stop" --log_path="systemd"
ynh_systemctl --service="${app}-server" --action="stop" --log_path="systemd"
ynh_systemctl --service="${app}-worker" --action="stop" --log_path="systemd"
# Remove the dedicated systemd config
ynh_config_remove_systemd"${app}-beat"
ynh_config_remove_systemd"${app}-server"
ynh_config_remove_systemd"${app}-worker"
ynh_safe_rm "/etc/systemd/system/$app.target"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression "Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_safe_rm "/etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf"
ynh_config_remove_nginx
#=================================================
# REMOVE LOGS
#=================================================
ynh_script_progression "Removing logs..."
ynh_config_remove_logrotate
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression "Removing Fail2Ban configuration..."
# Remove the dedicated Fail2Ban config
ynh_config_remove_fail2ban
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE REDIS DATABASE
#=================================================
ynh_script_progression "Removing the Redis database..."
# Remove a database if it exists, along with the associated user
ynh_redis_remove_db $redis_db
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Removal of $app completed"