1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00
transmission_ynh/scripts/remove

98 lines
3.1 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status transmission-daemon >/dev/null 2>&1
then
ynh_script_progression --message="Removing $app service..." --weight=8
yunohost service remove transmission-daemon
fi
#=================================================
# REMOVE TRANSMISSION-DAEMON
#=================================================
ynh_script_progression --message="Removing transmission..." --weight=9
ynh_remove_app_dependencies
#=================================================
# CLOSE THE PORTS
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $peer_port$"
then
ynh_script_progression --message="Closing port $peer_port..."
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
fi
#=================================================
# REMOVE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE DATA
#=================================================
ynh_script_progression --message="Removing transmission data..."
# Web interface
ynh_secure_remove --file=/usr/share/transmission
# And data
ynh_secure_remove --file=/var/lib/transmission-daemon
# Kernel parameters
ynh_secure_remove --file=/etc/sysctl.d/90-transmission.conf
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
sysctl --load=/etc/sysctl.d/90-transmission.conf
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete --username=debian-transmission
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last