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

Update remove script: don't use the official script which is essentially blowing hot air (and removes the system user which then makes yunohost unhappy)

This commit is contained in:
Alexandre Aubin 2024-01-06 20:43:38 +01:00
parent d4485f1312
commit 0d9de5c6a6
2 changed files with 18 additions and 23 deletions

View file

@ -52,12 +52,6 @@ ram.runtime = "50M"
sha256 = "77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95"
autoupdate.strategy = "latest_github_tag"
[resources.sources.uninstaller]
url = "https://raw.githubusercontent.com/netdata/netdata/v1.15.0/packaging/installer/netdata-uninstaller.sh"
sha256 = "a4727069b47138cea5c466bc902934545841c88dc5f641728ef0feb921efd218"
format = "whatever"
rename = "netdata-uninstaller.sh"
[resources.system_user]
[resources.install_dir]

View file

@ -30,24 +30,25 @@ ynh_remove_nginx_config
#=================================================
ynh_script_progression --message="Uninstalling Netdata..." --weight=6
# Prepare to execute uninstaller(generated by NetData install script)
UNINSTALL_SCRIPT="netdata-uninstaller.sh"
tmpdir=$(mktemp -d)
# Kill all netdata processes (essentially what the official uninstaller does)
pkill netdata
pkill -U netdata
ynh_setup_source --dest_dir="$tmpdir" --source_id="uninstaller"
chmod +x $tmpdir/$UNINSTALL_SCRIPT
# Move outside the directory (which will be removed)
pushd $tmpdir
# create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-uninstaller-log-XXXXXX.log)
# Execute the uninstall script
./${UNINSTALL_SCRIPT} --yes --force --env $install_dir/etc/netdata/.environment >$tmplog 2>$tmplog
popd
# Remove MySQL netdata user
ynh_mysql_execute_as_root "drop user 'netdata'@'localhost'; flush privileges;"
# 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