@cryptotaxi247 / netdata-1 / commits / 89c66bc73

fix minor installer issues on freebsd

Costa Tsaousis (ktsaou) committed Mar 4, 2017 at 23:47 UTC 89c66bc7389a037231eebc0085bb1d083aaac469
2 files changed +10 -4
installer/functions.sh
+2 -2
@@ -265,8 +265,8 @@ iscontainer() {
265
266 # /proc/1/sched exposes the host's pid of our init !
267 # http://stackoverflow.com/a/37016302
268 - local pid=$( cat /proc/1/sched | head -n 1 | { IFS='(),#:' read name pid th threads; echo $pid; } )
269 - local p=$(( pid + 0 ))
268 + local pid=$( cat /proc/1/sched 2>/dev/null | head -n 1 | { IFS='(),#:' read name pid th threads; echo $pid; } )
269 + pid=$(( pid + 0 ))
270 [ ${pid} -ne 1 ] && return 0
271
272 # lxc sets environment variable 'container'
netdata-installer.sh
+8 -2
@@ -49,7 +49,7 @@ umask 002
49 # Be nice on production environments
50 renice 19 $$ >/dev/null 2>/dev/null
51
52 -processors=$(grep ^processor </proc/cpuinfo 2>/dev/null | wc -l)
52 +processors=$(cat /proc/cpuinfo 2>/dev/null | grep ^processor | wc -l)
53 [ $(( processors )) -lt 1 ] && processors=1
54
55 # you can set CFLAGS before running installer
@@ -720,7 +720,13 @@ run chmod 755 "${NETDATA_LOG_DIR}"
720
721 if [ ${UID} -eq 0 ]
722 then
723 - run chown "${NETDATA_USER}:root" "${NETDATA_LOG_DIR}"
723 + # find the admin group
724 + admin_group=
725 + test -z "${admin_group}" && getent group root >/dev/null 2>&1 && admin_group="root"
726 + test -z "${admin_group}" && getent group daemon >/dev/null 2>&1 && admin_group="daemon"
727 + test -z "${admin_group}" && admin_group="${NETDATA_USER}"
728 +
729 + run chown "${NETDATA_USER}:${admin_group}" "${NETDATA_LOG_DIR}"
730 run chown -R root "${NETDATA_PREFIX}/usr/libexec/netdata"
731 run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type d -exec chmod 0755 {} \;
732 run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -exec chmod 0644 {} \;