summaryrefslogtreecommitdiffstats
path: root/netdata-installer.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xnetdata-installer.sh337
1 files changed, 140 insertions, 197 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh
index f59bc2b34..736fafdba 100755
--- a/netdata-installer.sh
+++ b/netdata-installer.sh
@@ -2,6 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later
+# Next unused error code: I0012
+
export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
uniquepath() {
path=""
@@ -38,6 +40,21 @@ fi
cd "${NETDATA_SOURCE_DIR}" || exit 1
# -----------------------------------------------------------------------------
+# load the required functions
+
+if [ -f "${INSTALLER_DIR}/packaging/installer/functions.sh" ]; then
+ # shellcheck source=packaging/installer/functions.sh
+ . "${INSTALLER_DIR}/packaging/installer/functions.sh" || exit 1
+else
+ # shellcheck source=packaging/installer/functions.sh
+ . "${NETDATA_SOURCE_DIR}/packaging/installer/functions.sh" || exit 1
+fi
+
+# Used to enable saved warnings support in functions.sh
+# shellcheck disable=SC2034
+NETDATA_SAVE_WARNINGS=1
+
+# -----------------------------------------------------------------------------
# figure out an appropriate temporary directory
_cannot_use_tmpdir() {
testfile="$(TMPDIR="${1}" mktemp -q -t netdata-test.XXXXXXXXXX)"
@@ -62,9 +79,7 @@ _cannot_use_tmpdir() {
if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}"; then
if _cannot_use_tmpdir /tmp; then
if _cannot_use_tmpdir "${PWD}"; then
- echo >&2
- echo >&2 "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
- exit 1
+ fatal "UUnable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again." I0000
else
TMPDIR="${PWD}"
fi
@@ -75,36 +90,18 @@ fi
# -----------------------------------------------------------------------------
# set up handling for deferred error messages
-NETDATA_DEFERRED_ERRORS=""
-
-defer_error() {
- NETDATA_DEFERRED_ERRORS="${NETDATA_DEFERRED_ERRORS}\n* ${1}"
-}
-
-defer_error_highlighted() {
- NETDATA_DEFERRED_ERRORS="${TPUT_YELLOW}${TPUT_BOLD}${NETDATA_DEFERRED_ERRORS}\n* ${1}${TPUT_RESET}"
-}
+#
+# This leverages the saved warnings functionality shared with some functions from functions.sh
print_deferred_errors() {
- if [ -n "${NETDATA_DEFERRED_ERRORS}" ]; then
- echo >&2
- echo >&2 "The following non-fatal errors were encountered during the installation process:"
- printf '%s' >&2 "${NETDATA_DEFERRED_ERRORS}"
- echo >&2
+ if [ -n "${SAVED_WARNINGS}" ]; then
+ printf >&2 "\n"
+ printf >&2 "%b\n" "The following warnings and non-fatal errors were encountered during the installation process:"
+ printf >&2 "%b\n" "${SAVED_WARNINGS}"
+ printf >&2 "\n"
fi
}
-# -----------------------------------------------------------------------------
-# load the required functions
-
-if [ -f "${INSTALLER_DIR}/packaging/installer/functions.sh" ]; then
- # shellcheck source=packaging/installer/functions.sh
- . "${INSTALLER_DIR}/packaging/installer/functions.sh" || exit 1
-else
- # shellcheck source=packaging/installer/functions.sh
- . "${NETDATA_SOURCE_DIR}/packaging/installer/functions.sh" || exit 1
-fi
-
download_go() {
download_file "${1}" "${2}" "go.d plugin" "go"
}
@@ -132,7 +129,7 @@ renice 19 $$ > /dev/null 2> /dev/null
# you can set CFLAGS before running installer
# shellcheck disable=SC2269
LDFLAGS="${LDFLAGS}"
-CFLAGS="${CFLAGS--O2}"
+CFLAGS="${CFLAGS-"-O2 -pipe"}"
[ "z${CFLAGS}" = "z-O3" ] && CFLAGS="-O2"
# shellcheck disable=SC2269
ACLK="${ACLK}"
@@ -159,11 +156,15 @@ banner_nonroot_install() {
${TPUT_RED}${TPUT_BOLD}Sorry! This will fail!${TPUT_RESET}
- You are attempting to install netdata as non-root, but you plan
+ You are attempting to install netdata as a non-root user, but you plan
to install it in system paths.
Please set an installation prefix, like this:
+ $PROGRAM ${@} --install-prefix /tmp
+
+ or
+
$PROGRAM ${@} --install /tmp
or, run the installer as root:
@@ -202,7 +203,8 @@ usage() {
USAGE: ${PROGRAM} [options]
where options include:
- --install <path> Install netdata in <path>. Ex. --install /opt will put netdata in /opt/netdata.
+ --install <path> Install netdata in <path>. Ex. --install /opt will put netdata in /opt/netdata, this option is deprecated and will be removed in a future version, please use --install-prefix instead.
+ --install-prefix <path> Install netdata in <path>. Ex. --install-prefix /opt will put netdata in /opt/netdata.
--dont-start-it Do not (re)start netdata after installation.
--dont-wait Run installation in non-interactive mode.
--stable-channel Use packages from GitHub release pages instead of nightly updates.
@@ -270,7 +272,10 @@ For the installer to complete successfully, you will need these packages install
For the plugins, you will at least need:
- curl, bash v4+, python v2 or v3, node.js
+ curl
+ bash (v4+)
+ python (v2 or v3)
+ node.js
HEREDOC
}
@@ -343,9 +348,10 @@ while [ -n "${1}" ]; do
"--enable-ebpf") NETDATA_DISABLE_EBPF=0 ;;
"--disable-ebpf") NETDATA_DISABLE_EBPF=1 NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ebpf)}" | sed 's/$/ --disable-ebpf/g')" ;;
"--skip-available-ram-check") SKIP_RAM_CHECK=1 ;;
+ "--one-time-build") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dependency-tracking)}" | sed 's/$/ --disable-dependency-tracking/g')" ;;
"--disable-cloud")
if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then
- echo "Cloud explicitly enabled, ignoring --disable-cloud."
+ warning "Cloud explicitly enabled, ignoring --disable-cloud."
else
NETDATA_DISABLE_CLOUD=1
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-cloud)}" | sed 's/$/ --disable-cloud/g')"
@@ -353,7 +359,7 @@ while [ -n "${1}" ]; do
;;
"--require-cloud")
if [ -n "${NETDATA_DISABLE_CLOUD}" ]; then
- echo "Cloud explicitly disabled, ignoring --require-cloud."
+ warning "Cloud explicitly disabled, ignoring --require-cloud."
else
NETDATA_REQUIRE_CLOUD=1
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-cloud)}" | sed 's/$/ --enable-cloud/g')"
@@ -369,6 +375,10 @@ while [ -n "${1}" ]; do
NETDATA_PREFIX="${2}/netdata"
shift 1
;;
+ "--install-prefix")
+ NETDATA_PREFIX="${2}/netdata"
+ shift 1
+ ;;
"--install-no-prefix")
NETDATA_PREFIX="${2}"
shift 1
@@ -378,7 +388,8 @@ while [ -n "${1}" ]; do
exit 1
;;
*)
- run_failed "I cannot understand option '$1'."
+ echo >&2 "Unrecognized option '${1}'."
+ exit_reason "Unrecognized option '${1}'." I000E
usage
exit 1
;;
@@ -433,8 +444,8 @@ if [ "$(uname -s)" = "Linux" ] && [ -f /proc/meminfo ]; then
if [ "${target_ram}" -gt "${total_ram}" ] && [ "${proc_count}" -gt 1 ] && [ -z "${SKIP_RAM_CHECK}" ]; then
target_ram="$(echo "${target_ram}" | awk '{$1/=1024*1024*1024;printf "%.2fGiB\n",$1}')"
total_ram="$(echo "${total_ram}" | awk '{$1/=1024*1024*1024;printf "%.2fGiB\n",$1}')"
- run_failed "Netdata needs ${target_ram} of RAM to safely install, but this system only has ${total_ram}."
- run_failed "Insufficient RAM available for an install. Try reducing the number of processes used for the install using the \$MAKEOPTS variable."
+ run_failed "Netdata needs ${target_ram} of RAM to safely install, but this system only has ${total_ram}. Try reducing the number of processes used for the install using the \$MAKEOPTS variable."
+ exit_reason "Insufficent RAM to safely install." I000F
exit 2
fi
fi
@@ -450,8 +461,8 @@ fi
if [ "$(id -u)" -ne 0 ]; then
if [ -z "${NETDATA_PREFIX}" ]; then
netdata_banner
- progress "wrong command line options!"
banner_nonroot_install "${@}"
+ exit_reason "Attempted install as non-root user to /." I0010
exit 1
else
banner_root_notify "${@}"
@@ -534,18 +545,7 @@ if [ ! "$have_autotools" ]; then
if [ -f configure ]; then
echo "Will skip autoreconf step"
else
- netdata_banner
- progress "autotools v2.60 required"
- cat << "EOF"
-
--------------------------------------------------------------------------------
-autotools 2.60 or later is required
-
-Sorry, you do not seem to have autotools 2.60 or later, which is
-required to build from the git sources of netdata.
-
-EOF
- exit 1
+ fatal "Could not find a usable version of GNU autotools, which is required for building Netdata. Version 2.60 or later of GNU autotools is required." I0001
fi
fi
@@ -557,6 +557,7 @@ if [ ${DONOTWAIT} -eq 0 ]; then
fi
read -r REPLY
if [ "$REPLY" != '' ]; then
+ exit_reason "User did not accept install attempt." I0011
exit 1
fi
@@ -564,44 +565,8 @@ fi
build_error() {
netdata_banner
- progress "sorry, it failed to build..."
- cat << EOF
-
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Sorry! netdata failed to build...
-
-You may need to check these:
-
-1. The package uuid-dev (or libuuid-devel) has to be installed.
-
- If your system cannot find libuuid, although it is installed
- run me with the option: --libs-are-really-here
-
-2. The package zlib1g-dev (or zlib-devel) has to be installed.
-
- If your system cannot find zlib, although it is installed
- run me with the option: --libs-are-really-here
-
-3. The package json-c-dev (or json-c-devel) has to be installed.
-
- If your system cannot find json-c, although it is installed
- run me with the option: --libs-are-really-here
-
-4. You need basic build tools installed, like:
-
- gcc make autoconf automake pkg-config
-
- Autoconf version 2.60 or higher is required.
-
-If you still cannot get it to build, ask for help at github:
-
- https://github.com/netdata/netdata/issues
-
-
-EOF
trap - EXIT
- exit 1
+ fatal "Netdata failed to build for an unknown reason." I0002
}
if [ ${LIBS_ARE_HERE} -eq 1 ]; then
@@ -620,18 +585,16 @@ build_protobuf() {
env_cmd=''
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
- env_cmd="env CFLAGS=-fPIC CXXFLAGS= LDFLAGS="
+ env_cmd="env CFLAGS='-fPIC -pipe' CXXFLAGS='-fPIC -pipe' LDFLAGS="
fi
cd "${1}" > /dev/null || return 1
- # shellcheck disable=SC2086
- if ! run ${env_cmd} ./configure --disable-shared --without-zlib --disable-dependency-tracking --with-pic; then
+ if ! run eval "${env_cmd} ./configure --disable-shared --without-zlib --disable-dependency-tracking --with-pic"; then
cd - > /dev/null || return 1
return 1
fi
- # shellcheck disable=SC2086
- if ! run ${env_cmd} $make ${MAKEOPTS}; then
+ if ! run eval "${env_cmd} ${make} ${MAKEOPTS}"; then
cd - > /dev/null || return 1
return 1
fi
@@ -654,7 +617,7 @@ bundle_protobuf() {
if [ -n "${USE_SYSTEM_PROTOBUF}" ]; then
echo "Skipping protobuf"
- defer_error "You have requested use of a system copy of protobuf. This should work, but it is not recommended as it's very likely to break if you upgrade the currently installed version of protobuf."
+ warning "You have requested use of a system copy of protobuf. This should work, but it is not recommended as it's very likely to break if you upgrade the currently installed version of protobuf."
return 0
fi
@@ -662,6 +625,13 @@ bundle_protobuf() {
PROTOBUF_PACKAGE_VERSION="$(cat packaging/protobuf.version)"
+ if [ -f "${PWD}/externaldeps/protobuf/.version" ] && [ "${PROTOBUF_PACKAGE_VERSION}" = "$(cat "${PWD}/externaldeps/protobuf/.version")" ]
+ then
+ echo >&2 "Found compiled protobuf, same version, not compiling it again. Remove file '${PWD}/externaldeps/protobuf/.version' to recompile."
+ NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-bundled-protobuf"
+ return 0
+ fi
+
tmp="$(mktemp -d -t netdata-protobuf-XXXXXX)"
PROTOBUF_PACKAGE_BASENAME="protobuf-cpp-${PROTOBUF_PACKAGE_VERSION}.tar.gz"
@@ -673,16 +643,15 @@ bundle_protobuf() {
if run tar --no-same-owner -xf "${tmp}/${PROTOBUF_PACKAGE_BASENAME}" -C "${tmp}" &&
build_protobuf "${tmp}/protobuf-${PROTOBUF_PACKAGE_VERSION}" &&
copy_protobuf "${tmp}/protobuf-${PROTOBUF_PACKAGE_VERSION}" &&
+ echo "${PROTOBUF_PACKAGE_VERSION}" >"${PWD}/externaldeps/protobuf/.version" &&
rm -rf "${tmp}"; then
run_ok "protobuf built and prepared."
NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-bundled-protobuf"
else
- run_failed "Failed to build protobuf."
- defer_error_highlighted "Failed to build protobuf. You may not be able to connect this node to Netdata Cloud."
+ run_failed "Failed to build protobuf. Netdata Cloud support will not be available in this build."
fi
else
- run_failed "Unable to fetch sources for protobuf."
- defer_error_highlighted "Unable to fetch sources for protobuf. You may not be able to connect this node to Netdata Cloud."
+ run_failed "Unable to fetch sources for protobuf. Netdata Cloud support will not be available in this build."
fi
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
@@ -697,7 +666,7 @@ build_judy() {
libtoolize="libtoolize"
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
- env_cmd="env CFLAGS=-fPIC CXXFLAGS= LDFLAGS="
+ env_cmd="env CFLAGS='-fPIC -pipe' CXXFLAGS='-fPIC -pipe' LDFLAGS="
fi
if [ "$(uname)" = "Darwin" ]; then
@@ -705,15 +674,14 @@ build_judy() {
fi
cd "${1}" > /dev/null || return 1
- # shellcheck disable=SC2086
- if run ${env_cmd} ${libtoolize} --force --copy &&
- run ${env_cmd} aclocal &&
- run ${env_cmd} autoheader &&
- run ${env_cmd} automake --add-missing --force --copy --include-deps &&
- run ${env_cmd} autoconf &&
- run ${env_cmd} ./configure &&
- run ${env_cmd} ${make} ${MAKEOPTS} -C src &&
- run ${env_cmd} ar -r src/libJudy.a src/Judy*/*.o; then
+ if run eval "${env_cmd} ${libtoolize} --force --copy" &&
+ run eval "${env_cmd} aclocal" &&
+ run eval "${env_cmd} autoheader" &&
+ run eval "${env_cmd} automake --add-missing --force --copy --include-deps" &&
+ run eval "${env_cmd} autoconf" &&
+ run eval "${env_cmd} ./configure" &&
+ run eval "${env_cmd} ${make} ${MAKEOPTS} -C src" &&
+ run eval "${env_cmd} ar -r src/libJudy.a src/Judy*/*.o"; then
cd - > /dev/null || return 1
else
cd - > /dev/null || return 1
@@ -762,23 +730,19 @@ bundle_judy() {
run_ok "libJudy built and prepared."
NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-bundled-libJudy"
else
- run_failed "Failed to build libJudy."
if [ -n "${NETDATA_BUILD_JUDY}" ]; then
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
-
- exit 1
+ fatal "failed to build libJudy." I0003
else
- defer_error_highlighted "Failed to build libJudy. dbengine support will be disabled."
+ run_failed "Failed to build libJudy, dbengine support will be disabled."
fi
fi
else
- run_failed "Unable to fetch sources for libJudy."
if [ -n "${NETDATA_BUILD_JUDY}" ]; then
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
-
- exit 1
+ fatal "Unable to fetch sources for libJudy, which is required for this build of Netdata." I0004
else
- defer_error_highlighted "Unable to fetch sources for libJudy. dbengine support will be disabled."
+ run_failed "Unable to fetch sources for libJudy, which is required for this build of Netdata."
fi
fi
@@ -792,15 +756,13 @@ build_jsonc() {
env_cmd=''
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
- env_cmd="env CFLAGS=-fPIC CXXFLAGS= LDFLAGS="
+ env_cmd="env CFLAGS='-fPIC -pipe' CXXFLAGS='-fPIC -pipe' LDFLAGS="
fi
cd "${1}" > /dev/null || exit 1
- # shellcheck disable=SC2086
- run ${env_cmd} cmake -DBUILD_SHARED_LIBS=OFF .
- # shellcheck disable=SC2086
- run ${env_cmd} ${make} ${MAKEOPTS}
- cd - > /dev/null || exit 1
+ run eval "${env_cmd} cmake -DBUILD_SHARED_LIBS=OFF ."
+ run eval "${env_cmd} ${make} ${MAKEOPTS}"
+ cd - > /dev/null || return 1
}
copy_jsonc() {
@@ -821,7 +783,6 @@ bundle_jsonc() {
if [ -z "$(command -v cmake)" ]; then
run_failed "Could not find cmake, which is required to build JSON-C. The install process will continue, but Netdata Cloud support will be disabled."
- defer_error_highlighted "Could not find cmake, which is required to build JSON-C. The install process will continue, but Netdata Cloud support will be disabled."
return 0
fi
@@ -845,12 +806,10 @@ bundle_jsonc() {
rm -rf "${tmp}"; then
run_ok "JSON-C built and prepared."
else
- run_failed "Failed to build JSON-C."
- defer_error_highlighted "Failed to build JSON-C. Netdata Cloud support will be disabled."
+ run_failed "Failed to build JSON-C, Netdata Cloud support will be disabled in this build."
fi
else
- run_failed "Unable to fetch sources for JSON-C."
- defer_error_highlighted "Unable to fetch sources for JSON-C. Netdata Cloud support will be disabled."
+ run_failed "Unable to fetch sources for JSON-C, Netdata Cloud support will be disabled in this build."
fi
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
@@ -890,13 +849,13 @@ detect_libc() {
cmd=$(ldd "$ls_path" | grep -w libc | cut -d" " -f 3)
if bash -c "${cmd}" 2>&1 | grep -q -i "GNU C Library"; then
echo >&2 " Detected GLIBC"
- libc="glibc"
- fi
- fi
+ libc="glibc"
+ fi
+ fi
fi
if [ -z "$libc" ]; then
- echo >&2 " ERROR: Cannot detect a supported libc on your system!"
+ warning "Cannot detect a supported libc on your system, eBPF support will be disabled."
return 1
fi
@@ -916,11 +875,11 @@ rename_libbpf_packaging() {
build_libbpf() {
- cd "${1}/src" > /dev/null || exit 1
+ cd "${1}/src" > /dev/null || return 1
mkdir root build
# shellcheck disable=SC2086
- run env CFLAGS=-fPIC CXXFLAGS= LDFLAGS= BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=.. ${make} ${MAKEOPTS} install
- cd - > /dev/null || exit 1
+ run env CFLAGS='-fPIC -pipe' CXXFLAGS='-fPIC -pipe' LDFLAGS= BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=.. ${make} ${MAKEOPTS} install
+ cd - > /dev/null || return 1
}
copy_libbpf() {
@@ -974,19 +933,17 @@ bundle_libbpf() {
rm -rf "${tmp}"; then
run_ok "libbpf built and prepared."
else
- run_failed "Failed to build libbpf."
if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 0 ]; then
- exit 1
+ fatal "failed to build libbpf." I0005
else
- defer_error_highlighted "Failed to build libbpf. You may not be able to use eBPF plugin."
+ run_failed "Failed to build libbpf. eBPF support will be disabled"
fi
fi
else
- run_failed "Unable to fetch sources for libbpf."
if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 0 ]; then
- exit 1
+ fatal "Failed to fetch sources for libbpf." I0006
else
- defer_error_highlighted "Unable to fetch sources for libbpf. You may not be able to use eBPF plugin."
+ run_failed "Unable to fetch sources for libbpf. eBPF support will be disabled"
fi
fi
@@ -1023,21 +980,19 @@ bundle_ebpf_co_re() {
rm -rf "${tmp}"; then
run_ok "libbpf built and prepared."
else
- run_failed "Failed to get eBPF CO-RE files."
if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 0 ]; then
- exit 1
+ fatal "Failed to get eBPF CO-RE files." I0007
else
- defer_error_highlighted "Failed to get CO-RE. You will not be able to use eBPF plugin."
+ run_failed "Failed to get eBPF CO-RE files. eBPF support will be disabled"
NETDATA_DISABLE_EBPF=1
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ebpf)}" | sed 's/$/ --disable-ebpf/g')"
fi
fi
else
- run_failed "Unable to fetch sources for libbpf."
if [ -n "${NETDATA_DISABLE_EBPF}" ] && [ ${NETDATA_DISABLE_EBPF} = 0 ]; then
- exit 1
+ fatal "Failed to fetch eBPF CO-RE files." I0008
else
- defer_error_highlighted "Unable to fetch sources for eBPF CO-RE. You will not be able to use eBPF plugin."
+ run_failed "Failed to fetch eBPF CO-RE files. eBPF support will be disabled"
NETDATA_DISABLE_EBPF=1
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ebpf)}" | sed 's/$/ --disable-ebpf/g')"
fi
@@ -1074,21 +1029,26 @@ echo >&2
progress "Run autotools to configure the build environment"
if [ "$have_autotools" ]; then
- run autoreconf -ivf || exit 1
+ if ! run autoreconf -ivf; then
+ fatal "Failed to prepare Netdata sources." I0009
+ fi
fi
# shellcheck disable=SC2086
-run ./configure \
- --prefix="${NETDATA_PREFIX}/usr" \
- --sysconfdir="${NETDATA_PREFIX}/etc" \
- --localstatedir="${NETDATA_PREFIX}/var" \
- --libexecdir="${NETDATA_PREFIX}/usr/libexec" \
- --libdir="${NETDATA_PREFIX}/usr/lib" \
- --with-zlib \
- --with-math \
- --with-user=netdata \
- ${NETDATA_CONFIGURE_OPTIONS} \
- CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" || exit 1
+if ! run ./configure \
+ --prefix="${NETDATA_PREFIX}/usr" \
+ --sysconfdir="${NETDATA_PREFIX}/etc" \
+ --localstatedir="${NETDATA_PREFIX}/var" \
+ --libexecdir="${NETDATA_PREFIX}/usr/libexec" \
+ --libdir="${NETDATA_PREFIX}/usr/lib" \
+ --with-zlib \
+ --with-math \
+ --with-user=netdata \
+ ${NETDATA_CONFIGURE_OPTIONS} \
+ CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"; then
+ fatal "Failed to configure Netdata sources." I000A
+fi
+
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
@@ -1106,39 +1066,15 @@ run $make clean
progress "Compile netdata"
# shellcheck disable=SC2086
-run $make ${MAKEOPTS} || exit 1
+if ! run $make ${MAKEOPTS}; then
+ fatal "Failed to build Netdata." I000B
+fi
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
# -----------------------------------------------------------------------------
[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing Netdata."
-progress "Migrate configuration files for node.d.plugin and charts.d.plugin"
-
-# migrate existing configuration files
-# for node.d and charts.d
-if [ -d "${NETDATA_PREFIX}/etc/netdata" ]; then
- # the configuration directory exists
-
- if [ ! -d "${NETDATA_PREFIX}/etc/netdata/charts.d" ]; then
- run mkdir "${NETDATA_PREFIX}/etc/netdata/charts.d"
- fi
-
- # move the charts.d config files
- for x in apache ap cpu_apps cpufreq example exim hddtemp load_average mem_apps mysql nginx nut opensips phpfpm postfix sensors squid tomcat; do
- for y in "" ".old" ".orig"; do
- if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" ] && [ ! -f "${NETDATA_PREFIX}/etc/netdata/charts.d/${x}.conf${y}" ]; then
- run mv -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" "${NETDATA_PREFIX}/etc/netdata/charts.d/${x}.conf${y}"
- fi
- done
- done
-
- if [ ! -d "${NETDATA_PREFIX}/etc/netdata/node.d" ]; then
- run mkdir "${NETDATA_PREFIX}/etc/netdata/node.d"
- fi
-
-fi
-
# -----------------------------------------------------------------------------
# shellcheck disable=SC2230
@@ -1199,7 +1135,9 @@ touch "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-done"
# -----------------------------------------------------------------------------
progress "Install netdata"
-run $make install || exit 1
+if ! run $make install; then
+ fatal "Failed to install Netdata." I000C
+fi
# -----------------------------------------------------------------------------
progress "Fix generated files permissions"
@@ -1307,7 +1245,9 @@ progress "Fix permissions of netdata directories (using user '${NETDATA_USER}')"
if [ ! -d "${NETDATA_RUN_DIR}" ]; then
# this is needed if NETDATA_PREFIX is not empty
- run mkdir -p "${NETDATA_RUN_DIR}" || exit 1
+ if ! run mkdir -p "${NETDATA_RUN_DIR}"; then
+ warning "Failed to create ${NETDATA_RUN_DIR}, it must becreated by hand or the Netdata Agent will not be able to be started."
+ fi
fi
# --- stock conf dir ----
@@ -1338,7 +1278,9 @@ run find "${NETDATA_WEB_DIR}" -type d -exec chmod 0775 {} \;
for x in "${NETDATA_LIB_DIR}" "${NETDATA_CACHE_DIR}" "${NETDATA_LOG_DIR}"; do
if [ ! -d "${x}" ]; then
echo >&2 "Creating directory '${x}'"
- run mkdir -p "${x}" || exit 1
+ if ! run mkdir -p "${x}"; then
+ warning "Failed to create ${x}, it must be created by hand or the Netdata Agent will not be able to be started."
+ fi
fi
run chown -R "${NETDATA_USER}:${NETDATA_GROUP}" "${x}"
@@ -1352,7 +1294,9 @@ run chmod 755 "${NETDATA_LOG_DIR}"
if [ ! -d "${NETDATA_CLAIMING_DIR}" ]; then
echo >&2 "Creating directory '${NETDATA_CLAIMING_DIR}'"
- run mkdir -p "${NETDATA_CLAIMING_DIR}" || exit 1
+ if ! run mkdir -p "${NETDATA_CLAIMING_DIR}"; then
+ warning "failed to create ${NETDATA_CLAIMING_DIR}, it will need to be created manually."
+ fi
fi
run chown -R "${NETDATA_USER}:${NETDATA_GROUP}" "${NETDATA_CLAIMING_DIR}"
run chmod 770 "${NETDATA_CLAIMING_DIR}"
@@ -1563,7 +1507,6 @@ install_go() {
if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
run_failed "go.d plugin download failed, go.d plugin will not be available"
- defer_error "go.d plugin download failed, go.d plugin will not be available"
echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
echo >&2
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
@@ -1580,8 +1523,7 @@ install_go() {
echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
echo >&2
- run_failed "go.d.plugin package files checksum validation failed."
- defer_error "go.d.plugin package files checksum validation failed, go.d.plugin will not be available"
+ run_failed "go.d.plugin package files checksum validation failed. go.d.plugin will not be available."
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
return 0
fi
@@ -1607,20 +1549,21 @@ install_go
should_install_ebpf() {
if [ "${NETDATA_DISABLE_EBPF:=0}" -eq 1 ]; then
- run_failed "eBPF explicitly disabled."
- defer_error "eBPF explicitly disabled."
+ run_failed "eBPF has been explicitly disabled, it will not be available in this install."
return 1
fi
if [ "$(uname -s)" != "Linux" ] || [ "$(uname -m)" != "x86_64" ]; then
- run_failed "Currently eBPF is only supported on Linux on X86_64."
- defer_error "Currently eBPF is only supported on Linux on X86_64."
+ if [ "${NETDATA_DISABLE_EBPF:=1}" -eq 0 ]; then
+ run_failed "Currently eBPF is only supported on Linux on X86_64."
+ fi
+
return 1
fi
# Check Kernel Config
if ! run "${INSTALLER_DIR}"/packaging/check-kernel-config.sh; then
- echo >&2 "Warning: Kernel unsupported or missing required config (eBPF may not work on your system)"
+ warning "Kernel unsupported or missing required config (eBPF may not work on your system)"
fi
return 0
@@ -1776,7 +1719,7 @@ if [ ${DONOTSTART} -eq 1 ]; then
create_netdata_conf "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
else
if ! restart_netdata "${NETDATA_PREFIX}/usr/sbin/netdata" "${@}"; then
- fatal "Cannot start netdata!"
+ fatal "Cannot start netdata!" I000D
fi
started=1