2021-03-01 14:53:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-02-01 14:51:55 +01:00
|
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
2021-03-01 14:53:57 +01:00
|
|
|
#=================================================
|
2024-02-01 14:51:55 +01:00
|
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
2021-03-01 14:53:57 +01:00
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
2024-02-01 14:51:55 +01:00
|
|
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
|
|
|
yunohost service remove "$app"
|
2021-03-01 14:53:57 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the dedicated systemd config
|
2022-07-27 20:53:30 +02:00
|
|
|
ynh_exec_warn_less ynh_remove_systemd_socket_config
|
|
|
|
ynh_exec_warn_less ynh_remove_systemd_config
|
|
|
|
|
2024-02-01 18:20:36 +01:00
|
|
|
# Stop LXC systemd services
|
|
|
|
ynh_systemd_action --service_name="lxc-net" --action="stop"
|
|
|
|
ynh_systemd_action --service_name="lxc" --action="stop"
|
|
|
|
|
2024-02-01 15:50:28 +01:00
|
|
|
_ynh_remove_ld_so
|
|
|
|
|
|
|
|
_ynh_unset_subuid_subgid
|
|
|
|
|
2024-02-01 16:50:39 +01:00
|
|
|
ynh_exec_warn ss -lp "sport = :domain"
|
|
|
|
|
2024-02-01 15:50:28 +01:00
|
|
|
_ynh_remove_dnsmasq
|
|
|
|
|
2024-02-01 16:50:39 +01:00
|
|
|
ynh_exec_warn ss -lp "sport = :domain"
|
|
|
|
|
2022-07-27 20:53:30 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE CONTAINERS
|
|
|
|
#=================================================
|
|
|
|
# Remove the data directory if --purge option is used
|
2024-02-01 14:51:55 +01:00
|
|
|
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]; then
|
2022-07-27 20:53:30 +02:00
|
|
|
ynh_script_progression --message="Removing containers..."
|
|
|
|
ynh_secure_remove --file="/var/lib/lxd"
|
|
|
|
fi
|
2021-03-01 14:53:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CLOSE A PORT
|
|
|
|
#=================================================
|
2024-02-01 14:51:55 +01:00
|
|
|
if yunohost firewall list | grep -q "\- 67$"; then
|
2021-03-02 15:59:40 +01:00
|
|
|
ynh_script_progression --message="Closing port 67..."
|
2021-03-01 19:00:42 +01:00
|
|
|
ynh_exec_warn_less yunohost firewall disallow Both 67
|
2021-03-01 14:53:57 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE VARIOUS FILES
|
|
|
|
#=================================================
|
2022-07-27 20:53:30 +02:00
|
|
|
ynh_script_progression --message="Removing various files..."
|
2021-03-01 14:53:57 +01:00
|
|
|
|
2021-03-01 19:00:42 +01:00
|
|
|
ynh_secure_remove --file="/usr/local/lib/$app"
|
2021-03-01 14:53:57 +01:00
|
|
|
|
|
|
|
# Remove the log files
|
2021-03-01 19:00:42 +01:00
|
|
|
ynh_secure_remove --file="/var/log/$app"
|
|
|
|
|
2022-01-14 15:43:42 +01:00
|
|
|
ynh_secure_remove --file="/usr/local/bin/fuidshift"
|
2021-03-01 19:00:42 +01:00
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxc"
|
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxc-to-lxd"
|
2022-01-14 15:43:42 +01:00
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxd"
|
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxd-agent"
|
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxd-benchmark"
|
2022-02-15 12:03:17 +01:00
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxd-migrate"
|
|
|
|
ynh_secure_remove --file="/usr/local/bin/lxd-user"
|
2021-03-16 14:10:32 +01:00
|
|
|
ynh_secure_remove --file="/etc/bash_completion.d/lxd-client"
|
2021-03-01 19:00:42 +01:00
|
|
|
|
2021-03-01 14:53:57 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-03-02 15:59:40 +01:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|