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" sha256 = "77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95"
autoupdate.strategy = "latest_github_tag" 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.system_user]
[resources.install_dir] [resources.install_dir]

View file

@ -30,24 +30,25 @@ ynh_remove_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Uninstalling Netdata..." --weight=6 ynh_script_progression --message="Uninstalling Netdata..." --weight=6
# Prepare to execute uninstaller(generated by NetData install script) # Kill all netdata processes (essentially what the official uninstaller does)
UNINSTALL_SCRIPT="netdata-uninstaller.sh" pkill netdata
tmpdir=$(mktemp -d) pkill -U netdata
ynh_setup_source --dest_dir="$tmpdir" --source_id="uninstaller" # Rm all files that netdata may have installed (this is copypasta of the official uninstaller script)
chmod +x $tmpdir/$UNINSTALL_SCRIPT ynh_secure_remove /etc/logrotate.d/netdata
ynh_secure_remove /etc/systemd/system/netdata.service
# Move outside the directory (which will be removed) ynh_secure_remove /lib/systemd/system/netdata.service
pushd $tmpdir ynh_secure_remove /usr/lib/systemd/system/netdata.service
# create a temporary file for the log ynh_secure_remove /etc/init.d/netdata
tmplog=$(mktemp /tmp/netdata-uninstaller-log-XXXXXX.log) ynh_secure_remove /etc/periodic/daily/netdata-updater
ynh_secure_remove /etc/cron.daily/netdata-updater
# Execute the uninstall script ynh_secure_remove "/usr/sbin/netdata"
./${UNINSTALL_SCRIPT} --yes --force --env $install_dir/etc/netdata/.environment >$tmplog 2>$tmplog ynh_secure_remove "/usr/share/netdata"
popd ynh_secure_remove "/usr/libexec/netdata"
ynh_secure_remove "/var/lib/netdata"
# Remove MySQL netdata user ynh_secure_remove "/var/cache/netdata"
ynh_mysql_execute_as_root "drop user 'netdata'@'localhost'; flush privileges;" ynh_secure_remove "/var/log/netdata"
ynh_secure_remove "/etc/netdata"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT