summaryrefslogtreecommitdiffstats
path: root/packaging/installer/netdata-uninstaller.sh
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/installer/netdata-uninstaller.sh')
-rwxr-xr-xpackaging/installer/netdata-uninstaller.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/packaging/installer/netdata-uninstaller.sh b/packaging/installer/netdata-uninstaller.sh
index 4326ebe25..dcd9d965d 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 ..."
@@ -758,8 +767,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 +778,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" || :