2013-10-29 14:26:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
2017-06-13 23:37:51 +02:00
|
|
|
|
2016-05-14 09:56:38 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2019-05-01 13:24:56 +02:00
|
|
|
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)
|
2017-06-13 23:37:51 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
2019-05-01 13:24:56 +02:00
|
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
|
2019-05-01 13:24:56 +02:00
|
|
|
# Remove a service from the admin panel, added by `yunohost service add`
|
|
|
|
if yunohost service status transmission-daemon >/dev/null 2>&1
|
2017-06-13 23:37:51 +02:00
|
|
|
then
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_script_progression --message="Removing $app service..." --weight=8
|
2017-08-27 22:01:10 +02:00
|
|
|
yunohost service remove transmission-daemon
|
2017-06-13 23:37:51 +02:00
|
|
|
fi
|
|
|
|
|
2019-06-03 14:22:01 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE TRANSMISSION-DAEMON
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing transmission..." --weight=9
|
|
|
|
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
# CLOSE THE PORTS
|
|
|
|
#=================================================
|
|
|
|
|
2017-08-27 22:01:10 +02:00
|
|
|
if yunohost firewall list | grep -q "\- $port$"
|
|
|
|
then
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_script_progression --message="Closing port $port..."
|
|
|
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
2017-08-27 22:01:10 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if yunohost firewall list | grep -q "\- $peer_port$"
|
|
|
|
then
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_script_progression --message="Closing port $peer_port..."
|
|
|
|
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
|
2017-08-27 22:01:10 +02:00
|
|
|
fi
|
2017-06-13 23:37:51 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2020-12-14 11:36:02 +01:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
2013-10-29 14:26:46 +01:00
|
|
|
|
2020-12-14 11:36:02 +01:00
|
|
|
# Remove the dedicated NGINX config
|
2017-08-27 22:01:10 +02:00
|
|
|
ynh_remove_nginx_config
|
2016-05-14 09:56:38 +02:00
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DATA
|
|
|
|
#=================================================
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_script_progression --message="Removing transmission data..."
|
2013-10-29 14:26:46 +01:00
|
|
|
|
2017-06-16 20:38:31 +02:00
|
|
|
# Web interface
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_secure_remove --file=/usr/share/transmission
|
2017-06-16 20:38:31 +02:00
|
|
|
# And data
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_secure_remove --file=/var/lib/transmission-daemon
|
2019-05-09 11:07:57 +02:00
|
|
|
# Kernel parameters
|
2020-04-15 12:34:27 +02:00
|
|
|
if [ -e /proc/sys/net/core/rmem_max ]
|
2020-03-03 19:06:26 +01:00
|
|
|
then
|
|
|
|
ynh_secure_remove --file=/etc/sysctl.d/90-transmission.conf
|
2019-05-09 12:25:08 +02:00
|
|
|
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
2019-05-09 11:44:17 +02:00
|
|
|
fi
|
2017-06-15 00:33:49 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2019-05-01 13:24:56 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user"
|
2017-06-15 00:33:49 +02:00
|
|
|
|
2019-05-01 13:24:56 +02:00
|
|
|
# Delete a system user
|
|
|
|
ynh_system_user_delete --username=debian-transmission
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|