1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00
netdata_ynh/scripts/remove

54 lines
1.9 KiB
Bash

#!/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 NGINX config
ynh_remove_nginx_config
#=================================================
# UNINSTALLING NETDATA
#=================================================
ynh_script_progression --message="Uninstalling Netdata..." --weight=6
# Kill all netdata processes (essentially what the official uninstaller does)
pkill netdata
pkill -U netdata
# Rm all files that netdata may have installed (this is copypasta of the official uninstaller script)
ynh_secure_remove /etc/logrotate.d/netdata
ynh_secure_remove /etc/systemd/system/netdata.service
ynh_secure_remove /lib/systemd/system/netdata.service
ynh_secure_remove /usr/lib/systemd/system/netdata.service
ynh_secure_remove /etc/init.d/netdata
ynh_secure_remove /etc/periodic/daily/netdata-updater
ynh_secure_remove /etc/cron.daily/netdata-updater
ynh_secure_remove "/usr/sbin/netdata"
ynh_secure_remove "/usr/share/netdata"
ynh_secure_remove "/usr/libexec/netdata"
ynh_secure_remove "/var/lib/netdata"
ynh_secure_remove "/var/cache/netdata"
ynh_secure_remove "/var/log/netdata"
ynh_secure_remove "/etc/netdata"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last