diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-04 23:47:09 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-04 23:47:09 +0200 |
commit | 89c66bc7389a037231eebc0085bb1d083aaac469 (patch) | |
tree | 61fac67f54a790848c23b8a45411478fa083d381 | |
parent | acba169f8c294db344b8ef2b62881a7da519e38f (diff) |
fix minor installer issues on freebsd
-rw-r--r-- | installer/functions.sh | 4 | ||||
-rwxr-xr-x | netdata-installer.sh | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/installer/functions.sh b/installer/functions.sh index 02b061d819..f27b4535b2 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 408e3f3dfc..b078ac6d5f 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 </proc/cpuinfo 2>/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 {} \; |