From 969facc313a9a6dbce377036d034748c8beea814 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Wed, 29 Nov 2017 23:33:33 +0100 Subject: [PATCH] Rewrite removal --- scripts/remove | 66 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/scripts/remove b/scripts/remove index 7488bca..32ef767 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,19 +9,63 @@ source _common.sh source /usr/share/yunohost/helpers -app=mumbleserver +#================================================= +# LOAD SETTINGS +#================================================= -# Getting port used by mumble to close it -port=$(ynh_app_setting_get $app port) +app=$YNH_APP_INSTANCE_NAME -# Uninstall Mumble and its dependencies -apt autoremove -y mumble-server > /dev/null 2>&1 +domain=$(ynh_app_setting_get "$app" domain) +port=$(ynh_app_setting_get "$app" port) +final_path=$(ynh_app_setting_get "$app" final_path) -# Close ports -yunohost firewall disallow Both $port > /dev/null 2>&1 +#================================================= +# STANDARD REMOVE +#================================================= +# STOP AND REMOVE SERVICE +#================================================= -# Removing config file -rm -f /etc/mumble-server.ini +# Remove the dedicated systemd config +ynh_remove_systemd_config -# Remove mumble-server service -yunohost service remove mumble-server +#================================================= +# REMOVE SERVICE FROM ADMIN PANEL +#================================================= + +if yunohost service status | grep -q "$app" +then + echo "Remove $app service" + yunohost service remove "$app" +fi + +#================================================= +# REMOVE DEPENDENCIES +#================================================= + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + +#================================================= +# REMOVE APP MAIN DIR +#================================================= + +# Remove the app directory securely +ynh_secure_remove "$final_path" + +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + echo "Close port $port" + yunohost firewall disallow Both "$port" > /dev/null 2>&1 +fi + +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE OTHER FILES +#================================================= + +ynh_secure_remove "/var/log/mumble-server/$app.log"