2022-07-20 12:04:29 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-02-14 14:13:22 +01:00
|
|
|
# Stopping Nomad
|
2022-07-20 12:04:29 +02:00
|
|
|
#=================================================
|
2024-02-14 14:13:22 +01:00
|
|
|
ynh_script_progression --message="Trying to stop gracefully $app..." --weight=1
|
2022-07-20 12:04:29 +02:00
|
|
|
|
2024-02-14 14:13:22 +01:00
|
|
|
ynh_exec_warn_less timeout 25 nomad node drain -self -enable -yes -deadline 20s
|
2022-07-20 12:04:29 +02:00
|
|
|
|
|
|
|
#=================================================
|
2024-02-14 14:13:22 +01:00
|
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
2022-07-20 12:04:29 +02:00
|
|
|
#=================================================
|
2024-02-14 14:13:22 +01:00
|
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
2022-07-20 12:04:29 +02:00
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
2024-02-14 14:13:22 +01:00
|
|
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
|
|
|
yunohost service remove "$app"
|
2022-07-20 12:04:29 +02:00
|
|
|
fi
|
|
|
|
# Remove the dedicated systemd config
|
|
|
|
ynh_remove_systemd_config
|
|
|
|
|
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
|
|
|
|
|
|
|
# Remove the dedicated NGINX config
|
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
2024-02-14 14:13:22 +01:00
|
|
|
if [ "$node_type" == "client" ] && [ "$driver_lxc" -eq 1 ]; then
|
|
|
|
client_lxc_bridge=$(ynh_app_setting_get --app="$app" --key=client_lxc_bridge)
|
2022-07-23 04:57:16 +02:00
|
|
|
|
2024-02-14 14:13:22 +01:00
|
|
|
ynh_systemd_action --service_name=lxc-net --action="stop"
|
|
|
|
systemctl disable lxc-net --quiet
|
|
|
|
ynh_secure_remove --file="/etc/default/lxc-net"
|
|
|
|
ynh_secure_remove --file="/etc/lxc/default.conf"
|
|
|
|
ynh_secure_remove --file="/etc/dnsmasq.d/lxd"
|
|
|
|
systemctl restart dnsmasq
|
2022-07-21 08:24:29 +02:00
|
|
|
fi
|
2022-07-20 12:04:29 +02:00
|
|
|
|
2022-07-22 02:31:36 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2024-02-14 14:13:22 +01:00
|
|
|
if [ "$node_type" == "client" ] && [ "$driver_lxc" -eq 1 ]; then
|
|
|
|
ynh_script_progression --message="Removing Go..." --weight=1
|
|
|
|
ynh_remove_go
|
2022-07-22 03:42:13 +02:00
|
|
|
fi
|
|
|
|
|
2022-07-20 12:04:29 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE VARIOUS FILES
|
|
|
|
#=================================================
|
2022-09-03 18:58:58 +02:00
|
|
|
ynh_script_progression --message="Removing various files..." --weight=1
|
2022-07-20 12:04:29 +02:00
|
|
|
|
|
|
|
# Remove a directory securely
|
2022-07-21 08:24:29 +02:00
|
|
|
ynh_secure_remove --file="$config_path"
|
2022-07-20 12:04:29 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-09-03 18:58:58 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|