#!/usr/bin/env bashexportPATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"netdata_source_dir="$(pwd)"installer_dir="$(dirname"${0}")"if["${netdata_source_dir}"!="${installer_dir}"-a"${installer_dir}"!="."]thenecho>&2"Warning: you are currently in '${netdata_source_dir}' but the installer is in '${installer_dir}'."fi# -----------------------------------------------------------------------------# reload the user profile[-f/etc/profile]&&./etc/profile
# make sure /etc/profile does not change our current directorycd"${netdata_source_dir}"||exit1# -----------------------------------------------------------------------------# load the required functionsif[-f"${installer_dir}/installer/functions.sh"]thensource"${installer_dir}/installer/functions.sh"||exit1elsesource"${netdata_source_dir}/installer/functions.sh"||exit1fi# make sure we save all commands we runrun_logfile="netdata-installer.log"# -----------------------------------------------------------------------------# fix PKG_CHECK_MODULES errorif[-d/usr/share/aclocal]thenACLOCAL_PATH=${ACLOCAL_PATH-/usr/share/aclocal}exportACLOCAL_PATH
fiexportLC_ALL=C
umask002# Be nice on production environments
renice19$$>/dev/null2>/dev/null
processors=$(cat/proc/cpuinfo2>/dev/null|grep^processor|wc-l)[$((processors))-lt1]&&processors=1# you can set CFLAGS before running installerCFLAGS="${CFLAGS--O2}"["z${CFLAGS}"="z-O3"]&&CFLAGS="-O2"# keep a log of this commandprintf