diff options
author | Paul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com> | 2019-05-19 23:37:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-19 23:37:18 +0300 |
commit | 7ab746008904f4c68a43d14753b55656dfcc2d01 (patch) | |
tree | 02cbe24bce6123758b0fcb4c208c70e723189439 /netdata-installer.sh | |
parent | c1b54fa6d248adcb6c0fdf9de3309b480a9be994 (diff) |
netdata/packaging: install/uninstall fixes for macOS case (#6045)
* netdata/packaging: install/uninstall fixes for macOS case
1) fix add/remove user and add/remove group to handle when running on mac
2) fix uninstaller to be more portable (function declarations that wont work everywhere)
3) add some portability code in the uninstaller, for add/remove user. Previously we just attempd a blind delete for linux
4) colorize uninstaller a little bit
* netdata/packaging: remove unused, as per coday (really..?)
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-x | netdata-installer.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index f32994e9d4..4ed4050fd7 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -515,20 +515,24 @@ progress "Fix generated files permissions" run find ./system/ -type f -a \! -name \*.in -a \! -name Makefile\* -a \! -name \*.conf -a \! -name \*.service -a \! -name \*.logrotate -exec chmod 755 {} \; # ----------------------------------------------------------------------------- -progress "Add user netdata to required user groups" +progress "Creating standard user and groups for netdata" NETDATA_WANTED_GROUPS="docker nginx varnish haproxy adm nsd proxy squid ceph nobody" NETDATA_ADDED_TO_GROUPS="" if [ "${UID}" -eq 0 ]; then + progress "Adding group 'netdata'" portable_add_group netdata || : + + progress "Adding user 'netdata'" portable_add_user netdata "${NETDATA_PREFIX}/var/lib/netdata" || : + progress "Assign user 'netdata' to required groups" for g in ${NETDATA_WANTED_GROUPS}; do # shellcheck disable=SC2086 portable_add_user_to_group ${g} netdata && NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS} ${g}" done else - run_failed "The installer does not run as root." + run_failed "The installer does not run as root. Nothing to do for user and groups" fi # ----------------------------------------------------------------------------- @@ -567,6 +571,7 @@ else fi NETDATA_GROUP="$(id -g -n "${NETDATA_USER}")" [ -z "${NETDATA_GROUP}" ] && NETDATA_GROUP="${NETDATA_USER}" +echo >&2 "Netdata user and group is finally set to: ${NETDATA_USER}/${NETDATA_GROUP}" # the owners of the web files NETDATA_WEB_USER="$(config_option "web" "web files owner" "${NETDATA_USER}")" |