1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lxd_ynh.git synced 2024-09-03 19:45:53 +02:00
lxd_ynh/scripts/remove
2024-02-01 15:52:35 +01:00

75 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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_exec_warn_less ynh_remove_systemd_socket_config
ynh_exec_warn_less ynh_remove_systemd_config
_ynh_remove_ld_so
_ynh_unset_subuid_subgid
_ynh_remove_dnsmasq
#=================================================
# REMOVE CONTAINERS
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]; then
ynh_script_progression --message="Removing containers..."
ynh_secure_remove --file="/var/lib/lxd"
fi
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- 67$"; then
ynh_script_progression --message="Closing port 67..."
ynh_exec_warn_less yunohost firewall disallow Both 67
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_secure_remove --file="/usr/local/lib/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
ynh_secure_remove --file="/usr/local/bin/fuidshift"
ynh_secure_remove --file="/usr/local/bin/lxc"
ynh_secure_remove --file="/usr/local/bin/lxc-to-lxd"
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"
ynh_secure_remove --file="/usr/local/bin/lxd-migrate"
ynh_secure_remove --file="/usr/local/bin/lxd-user"
ynh_secure_remove --file="/etc/bash_completion.d/lxd-client"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last