From 89c66bc7389a037231eebc0085bb1d083aaac469 Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Sat, 4 Mar 2017 23:47:09 +0200 Subject: [PATCH] fix minor installer issues on freebsd --- installer/functions.sh | 4 ++-- netdata-installer.sh | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/installer/functions.sh b/installer/functions.sh index 02b061d8..f27b4535 100644 --- a/installer/functions.sh +++ b/installer/functions.sh @@ -265,8 +265,8 @@ iscontainer() { # /proc/1/sched exposes the host's pid of our init ! # http://stackoverflow.com/a/37016302 - local pid=$( cat /proc/1/sched | head -n 1 | { IFS='(),#:' read name pid th threads; echo $pid; } ) - local p=$(( pid + 0 )) + local pid=$( cat /proc/1/sched 2>/dev/null | head -n 1 | { IFS='(),#:' read name pid th threads; echo $pid; } ) + pid=$(( pid + 0 )) [ ${pid} -ne 1 ] && return 0 # lxc sets environment variable 'container' diff --git a/netdata-installer.sh b/netdata-installer.sh index 408e3f3d..b078ac6d 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -49,7 +49,7 @@ umask 002 # Be nice on production environments renice 19 $$ >/dev/null 2>/dev/null -processors=$(grep ^processor /dev/null | wc -l) +processors=$(cat /proc/cpuinfo 2>/dev/null | grep ^processor | wc -l) [ $(( processors )) -lt 1 ] && processors=1 # you can set CFLAGS before running installer @@ -720,7 +720,13 @@ run chmod 755 "${NETDATA_LOG_DIR}" if [ ${UID} -eq 0 ] then - run chown "${NETDATA_USER}:root" "${NETDATA_LOG_DIR}" + # find the admin group + admin_group= + test -z "${admin_group}" && getent group root >/dev/null 2>&1 && admin_group="root" + test -z "${admin_group}" && getent group daemon >/dev/null 2>&1 && admin_group="daemon" + test -z "${admin_group}" && admin_group="${NETDATA_USER}" + + run chown "${NETDATA_USER}:${admin_group}" "${NETDATA_LOG_DIR}" run chown -R root "${NETDATA_PREFIX}/usr/libexec/netdata" run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type d -exec chmod 0755 {} \; run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -exec chmod 0644 {} \; -- 2.39.2