]> arthur.barton.de Git - netdata.git/blobdiff - netdata-installer.sh
updated configs.signatures
[netdata.git] / netdata-installer.sh
index 584e2e67b28597b3e35e6a44afee4dcec0dd06af..9957e95b59003343f34947ef49b62f5a57cfbd85 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
@@ -73,6 +73,7 @@ DONOTSTART=0
 DONOTWAIT=0
 NETDATA_PREFIX=
 LIBS_ARE_HERE=0
+NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS-}"
 
 usage() {
     netdata_banner "installer command line options"
@@ -84,7 +85,7 @@ Valid <installer options> are:
 
    --install /PATH/TO/INSTALL
 
-        If your give: --install /opt
+        If you give: --install /opt
         netdata will be installed in /opt/netdata
 
    --dont-start-it
@@ -97,6 +98,12 @@ Valid <installer options> are:
         Do not wait for the user to press ENTER.
         Start immediately building it.
 
+   --enable-plugin-freeipmi
+   --disable-plugin-freeipmi
+
+        Enable/disable the FreeIPMI plugin.
+        Default: enable it when libipmimonitoring is available.
+
    --zlib-is-really-here
    --libs-are-really-here
 
@@ -124,7 +131,7 @@ For the plugins, you will at least need:
 USAGE
 }
 
-md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null)"
+md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)"
 get_git_config_signatures() {
     local x s file md5
 
@@ -140,7 +147,7 @@ get_git_config_signatures() {
             for c in $(git log --follow "conf.d/${x}" | grep ^commit | cut -d ' ' -f 2)
             do
                     git checkout ${c} "conf.d/${x}" || continue
-                    s="$(cat "conf.d/${x}" | md5sum | cut -d ' ' -f 1)"
+                    s="$(cat "conf.d/${x}" | ${md5sum} | cut -d ' ' -f 1)"
                     echo >>configs.signatures.tmp "${s}:${x}"
                     echo "    ${s}"
             done
@@ -184,6 +191,14 @@ do
         then
         DONOTWAIT=1
         shift 1
+    elif [ "$1" = "--enable-plugin-freeipmi" ]
+        then
+        NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --enable-plugin-freeipmi"
+        shift 1
+    elif [ "$1" = "--disable-plugin-freeipmi" ]
+        then
+        NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --disable-plugin-freeipmi"
+        shift 1
     elif [ "$1" = "--help" -o "$1" = "-h" ]
         then
         usage
@@ -402,7 +417,10 @@ run ./configure \
     --prefix="${NETDATA_PREFIX}/usr" \
     --sysconfdir="${NETDATA_PREFIX}/etc" \
     --localstatedir="${NETDATA_PREFIX}/var" \
-    --with-zlib --with-math --with-user=netdata \
+    --with-zlib \
+    --with-math \
+    --with-user=netdata \
+    ${NETDATA_CONFIGURE_OPTIONS} \
     CFLAGS="${CFLAGS}" || exit 1
 
 # remove the build_error hook
@@ -702,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 {} \;
@@ -723,7 +747,7 @@ if [ ${UID} -eq 0 ]
             # if we managed to setcap
             # but we fail to execute apps.plugin
             # trigger setuid to root
-            "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" -v >/dev/null 2>&1
+            "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" -t >/dev/null 2>&1
             setcap_ret=$?
         fi
     fi
@@ -734,6 +758,13 @@ if [ ${UID} -eq 0 ]
         run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
         run chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
     fi
+
+    if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/freeipmi.plugin" ]
+        then
+        run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/freeipmi.plugin"
+        run chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/freeipmi.plugin"
+    fi
+
 else
     run chown "${NETDATA_USER}:${NETDATA_USER}" "${NETDATA_LOG_DIR}"
     run chown -R "${NETDATA_USER}:${NETDATA_USER}" "${NETDATA_PREFIX}/usr/libexec/netdata"
@@ -1216,10 +1247,10 @@ progress "Basic netdata instructions"
 
 cat <<END
 
-netdata by default netdata listens on all IPs on port ${NETDATA_PORT},
+netdata by default listens on all IPs on port ${NETDATA_PORT},
 so you can access it with:
 
-http://this.machine.ip:${NETDATA_PORT}/
+  ${TPUT_CYAN}${TPUT_BOLD}http://this.machine.ip:${NETDATA_PORT}/${TPUT_RESET}
 
 To stop netdata, just kill it, with:
 
@@ -1231,7 +1262,7 @@ To start it, just run it:
 
 
 END
-echo >&2 "Uninstall script generated: ${TPUT_YELLOW}${TPUT_BOLD}./netdata-uninstaller.sh${TPUT_RESET}"
+echo >&2 "Uninstall script generated: ${TPUT_RED}${TPUT_BOLD}./netdata-uninstaller.sh${TPUT_RESET}"
 
 if [ -d .git ]
     then
@@ -1243,6 +1274,7 @@ force=0
 
 export PATH="\${PATH}:${PATH}"
 export CFLAGS="${CFLAGS}"
+export NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS}"
 
 INSTALL_UID="${UID}"
 if [ "\${INSTALL_UID}" != "\${UID}" ]
@@ -1347,7 +1379,16 @@ update && exit 0
 REINSTALL
     chmod 755 netdata-updater.sh.new
     mv -f netdata-updater.sh.new netdata-updater.sh
-    echo >&2 "Update script generated   : ${TPUT_YELLOW}${TPUT_BOLD}./netdata-updater.sh${TPUT_RESET}"
+    echo >&2 "Update script generated   : ${TPUT_GREEN}${TPUT_BOLD}./netdata-updater.sh${TPUT_RESET}"
+    echo >&2
+    echo >&2 "${TPUT_DIM}${TPUT_BOLD}netdata-updater.sh${TPUT_RESET}${TPUT_DIM} can work from cron. It will trigger an email from cron"
+    echo >&2 "only if it fails (it does not print anything if it can update netdata).${TPUT_RESET}"
+    if [ "${UID}" -eq 0 -a -d "/etc/cron.daily" -a ! -f "/etc/cron.daily/netdata-updater.sh" ]
+        then
+        echo >&2 "${TPUT_DIM}Run this to automatically check and install netdata updates once per day:${TPUT_RESET}"
+        echo >&2
+        echo >&2 "${TPUT_YELLOW}${TPUT_BOLD}ln -s ${PWD}/netdata-updater.sh /etc/cron.daily/netdata-updater.sh${TPUT_RESET}"
+    fi
 elif [ -f "netdata-updater.sh" ]
     then
     rm "netdata-updater.sh"