]> arthur.barton.de Git - netdata.git/commitdiff
fix minor installer issues on freebsd
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 4 Mar 2017 21:47:09 +0000 (23:47 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 4 Mar 2017 21:47:09 +0000 (23:47 +0200)
installer/functions.sh
netdata-installer.sh

index 02b061d81999e470370ff250f46db194c4dbe7a5..f27b4535b28284dfd8f968ba1a88832d960d28a1 100644 (file)
@@ -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'
index 408e3f3dfc5276d44b776a4106c140ffc24104c3..b078ac6d5f46486ed73fb433ae4a49f6e4add4c4 100755 (executable)
@@ -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 {} \;