X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=netdata-installer.sh;h=4e1847fa3cd1c41974b0b6a659ea91015d7416ca;hb=530ef0b6bb80eb32416752bfcc7a5b50f021503e;hp=95732e9a35af980acc23726d1a68c06a82ee299c;hpb=e0beae55f41268c0fffb1064e812a2e0d28b39b3;p=netdata.git diff --git a/netdata-installer.sh b/netdata-installer.sh index 95732e9a..4e1847fa 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -1,9 +1,20 @@ #!/usr/bin/env bash +export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" + +netdata_source_dir="$(pwd)" +installer_dir="$(dirname "${0}")" + +if [ "${netdata_source_dir}" != "${installer_dir}" -a "${installer_dir}" != "." ] + then + echo >&2 "Warninng: you are currently in '${netdata_source_dir}' but the installer is in '${installer_dir}'." +fi + # reload the user profile [ -f /etc/profile ] && . /etc/profile -export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" +# make sure /etc/profile does not change our current directory +cd "${netdata_source_dir}" || exit 1 # fix PKG_CHECK_MODULES error if [ -d /usr/share/aclocal ] @@ -18,11 +29,12 @@ umask 002 # Be nice on production environments renice 19 $$ >/dev/null 2>/dev/null -processors=$(cat /proc/cpuinfo | grep ^processor | wc -l) +processors=$(grep ^processor /dev/null | wc -l) [ $(( processors )) -lt 1 ] && processors=1 # you can set CFLAGS before running installer -CFLAGS="${CFLAGS--O3}" +CFLAGS="${CFLAGS--O2}" +[ "z${CFLAGS}" = "z-O3" ] && CFLAGS="-O2" # keep a log of this command printf "\n# " >>netdata-installer.log @@ -57,6 +69,7 @@ banner() { echo >&2 } +setcap="$(which setcap 2>/dev/null || command -v setcap 2>/dev/null)" service="$(which service 2>/dev/null || command -v service 2>/dev/null)" systemctl="$(which systemctl 2>/dev/null || command -v systemctl 2>/dev/null)" service() { @@ -112,7 +125,7 @@ Valid are: Use this option to allow it continue without checking pkg-config. -Netdata will by default be compiled with gcc optimization -O3 +Netdata will by default be compiled with gcc optimization -O2 If you need to pass different CFLAGS, use something like this: CFLAGS="" ${ME} @@ -381,7 +394,7 @@ run() { printf >&2 "\n" printf >&2 ":-----------------------------------------------------------------------------\n" - printf >&2 "Running command:\n" + printf >&2 "Running command (in $(pwd)):\n" printf >&2 "\n" printf >&2 "%q " "${@}" printf >&2 "\n" @@ -692,12 +705,16 @@ run find ./system/ -type f -a \! -name \*.in -a \! -name Makefile\* -a \! -name NETDATA_ADDED_TO_DOCKER=0 NETDATA_ADDED_TO_NGINX=0 +NETDATA_ADDED_TO_VARNISH=0 +NETDATA_ADDED_TO_HAPROXY=0 if [ ${UID} -eq 0 ] then portable_add_group netdata portable_add_user netdata portable_add_user_to_group docker netdata && NETDATA_ADDED_TO_DOCKER=1 portable_add_user_to_group nginx netdata && NETDATA_ADDED_TO_NGINX=1 + portable_add_user_to_group varnish netdata && NETDATA_ADDED_TO_VARNISH=1 + portable_add_user_to_group haproxy netdata && NETDATA_ADDED_TO_HAPROXY=1 if [ -d /etc/logrotate.d -a ! -f /etc/logrotate.d/netdata ] then @@ -837,8 +854,11 @@ if [ ${UID} -eq 0 ] setcap_ret=1 if ! iscontainer then - run setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" - setcap_ret=$? + if [ ! -z "${setcap}" ] + then + run setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" + setcap_ret=$? + fi if [ ${setcap_ret} -eq 0 ] then @@ -1343,6 +1363,25 @@ if [ $? -eq 0 -a "${NETDATA_ADDED_TO_NGINX}" = "1" ] echo " gpasswd -d netdata nginx" fi +getent group varnish > /dev/null +if [ $? -eq 0 -a "${NETDATA_ADDED_TO_VARNISH}" = "1" ] + then + echo + echo "You may also want to remove the netdata user from the varnish group" + echo "by running:" + echo " gpasswd -d netdata varnish" +fi + +getent group haproxy > /dev/null +if [ $? -eq 0 -a "${NETDATA_ADDED_TO_HAPROXY}" = "1" ] + then + echo + echo "You may also want to remove the netdata user from the haproxy group" + echo "by running:" + echo " gpasswd -d netdata haproxy" +fi + + UNINSTALL chmod 750 netdata-uninstaller.sh