mirror of
https://github.com/YunoHost-Apps/nomad_ynh.git
synced 2024-09-03 19:55:53 +02:00
69 lines
2.3 KiB
Bash
Executable file
69 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# Stopping Nomad
|
|
#=================================================
|
|
ynh_script_progression --message="Trying to stop gracefully $app..." --weight=1
|
|
|
|
ynh_exec_warn_less timeout 25 nomad node drain -self -enable -yes -deadline 20s
|
|
|
|
#=================================================
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
|
yunohost service remove "$app"
|
|
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
|
|
|
|
if [ "$node_type" == "client" ] && [ "$driver_lxc" -eq 1 ]; then
|
|
client_lxc_bridge=$(ynh_app_setting_get --app="$app" --key=client_lxc_bridge)
|
|
|
|
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
|
|
fi
|
|
|
|
#=================================================
|
|
# REMOVE DEPENDENCIES
|
|
#=================================================
|
|
if [ "$node_type" == "client" ] && [ "$driver_lxc" -eq 1 ]; then
|
|
ynh_script_progression --message="Removing Go..." --weight=1
|
|
ynh_remove_go
|
|
fi
|
|
|
|
#=================================================
|
|
# REMOVE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Removing various files..." --weight=1
|
|
|
|
# Remove a directory securely
|
|
ynh_secure_remove --file="$config_path"
|
|
|
|
# Remove the log files
|
|
ynh_secure_remove --file="/var/log/$app"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|