mirror of
https://github.com/YunoHost-Apps/transmission_ynh.git
synced 2024-09-04 01:46:12 +02:00
92 lines
2.6 KiB
Bash
92 lines
2.6 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
port=$(ynh_app_setting_get $app port)
|
|
peer_port=$(ynh_app_setting_get $app peer_port)
|
|
|
|
#=================================================
|
|
# STANDARD REMOVE
|
|
#=================================================
|
|
# REMOVE TRANSMISSION-DAEMON
|
|
#=================================================
|
|
|
|
ynh_apt purge transmission-daemon
|
|
ynh_package_autoremove transmission-common
|
|
|
|
#=================================================
|
|
# DISABLE SERVICE IN ADMIN PANEL
|
|
#=================================================
|
|
|
|
if yunohost service status | grep -q transmission-daemon
|
|
then
|
|
echo "Remove transmission-daemon service"
|
|
yunohost service remove transmission-daemon
|
|
fi
|
|
|
|
#=================================================
|
|
# CLOSE THE PORTS
|
|
#=================================================
|
|
|
|
if yunohost firewall list | grep -q "\- $port$"
|
|
then
|
|
echo "Close port $port"
|
|
yunohost firewall disallow TCP $port 2>&1
|
|
fi
|
|
|
|
if yunohost firewall list | grep -q "\- $peer_port$"
|
|
then
|
|
echo "Close port $peer_port"
|
|
yunohost firewall disallow Both $peer_port 2>&1
|
|
fi
|
|
|
|
#=================================================
|
|
# REMOVE THE NGINX CONFIGURATION
|
|
#=================================================
|
|
|
|
# Remove the dedicated nginx config
|
|
ynh_remove_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC REMOVE
|
|
#=================================================
|
|
# REMOVE DATA
|
|
#=================================================
|
|
|
|
backup_core_only=$(ynh_app_setting_get $app backup_core_only)
|
|
# If backup_core_only have a value in settings.yml, do not remove the data directory
|
|
if [ -z $backup_core_only ]
|
|
then
|
|
ynh_secure_remove /home/yunohost.transmission
|
|
fi
|
|
|
|
# And remove the link in yunohost.multimedia
|
|
rm "/home/yunohost.multimedia/share/Torrents"
|
|
rm "/home/yunohost.multimedia/share/Torrent to download"
|
|
|
|
# Web interface
|
|
ynh_secure_remove /usr/share/transmission
|
|
# And data
|
|
ynh_secure_remove /var/lib/transmission-daemon
|
|
|
|
#=================================================
|
|
# GENERIC FINALISATION
|
|
#=================================================
|
|
# REMOVE DEDICATED USER
|
|
#=================================================
|
|
|
|
ynh_system_user_delete debian-transmission
|