1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00
This commit is contained in:
Éric Gaspar 2023-12-28 10:55:43 +01:00
parent 52bb985d88
commit 4c915034da
2 changed files with 23 additions and 22 deletions

View file

@ -173,23 +173,23 @@ portable_del_group() {
return 1 return 1
} }
portable_del_user() { # portable_del_user() {
local username="${1}" # local username="${1}"
echo >&2 "Deleting ${username} user account ..." # echo >&2 "Deleting ${username} user account ..."
# Linux # # Linux
if command -v userdel 1>/dev/null 2>&1; then # if command -v userdel 1>/dev/null 2>&1; then
run userdel -f "${username}" && return 0 # run userdel -f "${username}" && return 0
fi # fi
# mac OS # # mac OS
if command -v sysadminctl 1>/dev/null 2>&1; then # if command -v sysadminctl 1>/dev/null 2>&1; then
run sysadminctl -deleteUser "${username}" && return 0 # run sysadminctl -deleteUser "${username}" && return 0
fi # fi
echo >&2 "User ${username} could not be deleted from system, you might have to remove it manually" # echo >&2 "User ${username} could not be deleted from system, you might have to remove it manually"
return 1 # return 1
} # }
portable_del_user_from_group() { portable_del_user_from_group() {
local groupname="${1}" username="${2}" local groupname="${1}" username="${2}"
@ -324,10 +324,10 @@ if [ -n "$NETDATA_ADDED_TO_GROUPS" ]; then
done done
fi fi
#### REMOVE USER # #### REMOVE USER
user_input "Press ENTER to delete 'netdata' system user > " # user_input "Press ENTER to delete 'netdata' system user > "
portable_del_user "netdata" || : # portable_del_user "netdata" || :
### REMOVE GROUP # ### REMOVE GROUP
user_input "Press ENTER to delete 'netdata' system group > " # user_input "Press ENTER to delete 'netdata' system group > "
portable_del_group "netdata" || : # portable_del_group "netdata" || :

View file

@ -34,9 +34,10 @@ ynh_script_progression --message="Uninstalling Netdata..." --weight=6
UNINSTALL_SCRIPT="netdata-uninstaller.sh" UNINSTALL_SCRIPT="netdata-uninstaller.sh"
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmpdir" --source_id="uninstaller" #ynh_setup_source --dest_dir="$tmpdir" --source_id="uninstaller"
cp ../conf/netdata-uninstaller.sh $tmpdir
chmod +x $tmpdir/$UNINSTALL_SCRIPT chmod +x $tmpdir/$UNINSTALL_SCRIPT
# Move outside the directory (which will be removed) # Move outside the directory (which will be removed)
pushd $tmpdir pushd $tmpdir
# create a temporary file for the log # create a temporary file for the log