#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME #================================================= # STANDARD REMOVE #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= # 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 ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_socket_config ynh_exec_warn_less ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= ynh_script_progression --message="Removing dependencies..." --weight=20 # Remove metapackage and its dependencies ynh_exec_warn_less ynh_remove_app_dependencies #================================================= # 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 #================================================= # Remove a directory securely ynh_secure_remove --file="/etc/ld.so.conf.d/$app.conf" ldconfig 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-p2c" ynh_secure_remove --file="/etc/bash_completion.d/lxd-client" sed -i "/# Added by lxd$/{N;/root:100000:65536/d}" /etc/sub{u,g}id ynh_secure_remove --file="/etc/dnsmasq.d/lxd" systemctl restart dnsmasq #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app #================================================= # 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 #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Removal of $app completed" --last