diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:19:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:53:24 +0000 |
commit | b5f8ee61a7f7e9bd291dd26b0585d03eb686c941 (patch) | |
tree | d4d31289c39fc00da064a825df13a0b98ce95b10 /packaging/installer/netdata-uninstaller.sh | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.tar.xz netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.zip |
Adding upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/netdata-uninstaller.sh')
-rwxr-xr-x | packaging/installer/netdata-uninstaller.sh | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/packaging/installer/netdata-uninstaller.sh b/packaging/installer/netdata-uninstaller.sh index 4326ebe25..c69bbd56e 100755 --- a/packaging/installer/netdata-uninstaller.sh +++ b/packaging/installer/netdata-uninstaller.sh @@ -520,6 +520,15 @@ portable_del_user_from_group() { groupname="${1}" username="${2}" + if command -v getent > /dev/null 2>&1; then + getent group "${1:-""}" | grep -q "${2}" + else + grep "^${1}:" /etc/group | grep -q "${2}" + fi + + ret=$? + [ "${ret}" != "0" ] && return 0 + # username is not in group info "Deleting ${username} user from ${groupname} group ..." @@ -714,8 +723,13 @@ trap quit_msg EXIT info "Stopping a possibly running netdata..." stop_all_netdata +if [ "$(uname -s)" = "Darwin" ]; then + launchctl unload /Library/LaunchDaemons/com.github.netdata.plist 2>/dev/null +fi + #### REMOVE NETDATA FILES rm_file /etc/logrotate.d/netdata +rm_file /usr/lib/systemd/journald@netdata.conf.d/netdata.conf rm_file /etc/systemd/system/netdata.service rm_file /lib/systemd/system/netdata.service rm_file /usr/lib/systemd/system/netdata.service @@ -732,6 +746,7 @@ rm_file /etc/periodic/daily/netdata-updater rm_file /etc/cron.daily/netdata-updater rm_file /etc/cron.d/netdata-updater rm_file /etc/cron.d/netdata-updater-daily +rm_file /Library/LaunchDaemons/com.github.netdata.plist if [ -n "${NETDATA_PREFIX}" ] && [ -d "${NETDATA_PREFIX}" ] && [ "netdata" = "$(basename "$NETDATA_PREFIX")" ] ; then @@ -750,6 +765,7 @@ else rm_dir "${NETDATA_PREFIX}/var/cache/netdata" rm_dir "${NETDATA_PREFIX}/var/log/netdata" rm_dir "${NETDATA_PREFIX}/etc/netdata" + rm_dir /usr/lib/systemd/journald@netdata.conf.d/ fi if [ -n "${tmpdir}" ]; then @@ -758,8 +774,10 @@ fi FILE_REMOVAL_STATUS=1 -#### REMOVE NETDATA USER FROM ADDED GROUPS -if [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then +#### REMOVE USER +if user_input "Do you want to delete 'netdata' system user ? "; then + portable_del_user "netdata" || : +elif [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then if user_input "Do you want to delete 'netdata' from following groups: '$NETDATA_ADDED_TO_GROUPS' ? "; then for group in $NETDATA_ADDED_TO_GROUPS; do portable_del_user_from_group "${group}" "netdata" @@ -767,11 +785,6 @@ if [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then fi fi -#### REMOVE USER -if user_input "Do you want to delete 'netdata' system user ? "; then - portable_del_user "netdata" || : -fi - ### REMOVE GROUP if user_input "Do you want to delete 'netdata' system group ? "; then portable_del_group "netdata" || : |