summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaneamarius <locomotion.itservices@gmail.com>2022-02-08 14:38:08 +0200
committerGitHub <noreply@github.com>2022-02-08 14:38:08 +0200
commit87071cbae24e9266f327509c39057c55eb628911 (patch)
tree4c4845a2c57e07a8148811bc97e1e42adb36be62
parent2e627b8ad5c52a61b31a999a21df7f808e3bdc2e (diff)
update scripts for POSIX compatibility (#11961)
-rwxr-xr-xnetdata-installer.sh329
-rw-r--r--packaging/installer/functions.sh128
2 files changed, 231 insertions, 226 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh
index 058e596014..8fd6e38752 100755
--- a/netdata-installer.sh
+++ b/netdata-installer.sh
@@ -1,20 +1,23 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
-# shellcheck disable=SC2046,SC2086,SC2166
export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
uniquepath() {
- local path=""
- while read -r; do
- if [[ ! ${path} =~ (^|:)"${REPLY}"(:|$) ]]; then
+ path=""
+ tmp="$(mktemp)"
+ (echo "${PATH}" | tr ":" "\n") > "$tmp"
+ while read -r REPLY;
+ do
+ if echo "${path}" | grep -v "(^|:)${REPLY}(:|$)"; then
[ -n "${path}" ] && path="${path}:"
path="${path}${REPLY}"
fi
- done < <(echo "${PATH}" | tr ":" "\n")
-
- [ -n "${path}" ] && [[ ${PATH} =~ /bin ]] && [[ ${PATH} =~ /sbin ]] && export PATH="${path}"
-}
+ done < "$tmp"
+rm "$tmp"
+ [ -n "${path}" ]
+export PATH="${path%:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin}"
+} > /dev/null
uniquepath
PROGRAM="$0"
@@ -58,7 +61,6 @@ cd "${NETDATA_SOURCE_DIR}" || exit 1
# -----------------------------------------------------------------------------
# figure out an appropriate temporary directory
_cannot_use_tmpdir() {
- local testfile ret
testfile="$(TMPDIR="${1}" mktemp -q -t netdata-test.XXXXXXXXXX)"
ret=0
@@ -108,8 +110,7 @@ print_deferred_errors() {
if [ -n "${NETDATA_DEFERRED_ERRORS}" ]; then
echo >&2
echo >&2 "The following non-fatal errors were encountered during the installation process:"
- # shellcheck disable=SC2059
- printf >&2 "${NETDATA_DEFERRED_ERRORS}"
+ printf '%s' >&2 "${NETDATA_DEFERRED_ERRORS}"
echo >&2
fi
}
@@ -119,10 +120,10 @@ print_deferred_errors() {
if [ -f "${INSTALLER_DIR}/packaging/installer/functions.sh" ]; then
# shellcheck source=packaging/installer/functions.sh
- source "${INSTALLER_DIR}/packaging/installer/functions.sh" || exit 1
+ . "${INSTALLER_DIR}/packaging/installer/functions.sh" || exit 1
else
# shellcheck source=packaging/installer/functions.sh
- source "${NETDATA_SOURCE_DIR}/packaging/installer/functions.sh" || exit 1
+ . "${NETDATA_SOURCE_DIR}/packaging/installer/functions.sh" || exit 1
fi
download_go() {
@@ -130,6 +131,8 @@ download_go() {
}
# make sure we save all commands we run
+# Variable is used by code in the packaging/installer/functions.sh
+# shellcheck disable=SC2034
run_logfile="netdata-installer.log"
@@ -148,19 +151,22 @@ umask 002
renice 19 $$ > /dev/null 2> /dev/null
# you can set CFLAGS before running installer
+# shellcheck disable=SC2269
LDFLAGS="${LDFLAGS}"
CFLAGS="${CFLAGS--O2}"
[ "z${CFLAGS}" = "z-O3" ] && CFLAGS="-O2"
+# shellcheck disable=SC2269
ACLK="${ACLK}"
# keep a log of this command
-# shellcheck disable=SC2129
-printf "\n# " >> netdata-installer.log
-date >> netdata-installer.log
-printf 'CFLAGS="%s" ' "${CFLAGS}" >> netdata-installer.log
-printf 'LDFLAGS="%s" ' "${LDFLAGS}" >> netdata-installer.log
-printf "%q " "${PROGRAM}" "${@}" >> netdata-installer.log
-printf "\n" >> netdata-installer.log
+{
+ printf "\n# "
+ date
+ printf 'CFLAGS="%s" ' "${CFLAGS}"
+ printf 'LDFLAGS="%s" ' "${LDFLAGS}"
+ printf "%s" "${PROGRAM}" "${@}"
+ printf "\n"
+} >> netdata-installer.log
REINSTALL_OPTIONS="$(
printf "%s" "${*}"
@@ -210,7 +216,8 @@ NONROOT
}
usage() {
- netdata_banner "installer command line options"
+ netdata_banner
+ progress "installer command line options"
cat << HEREDOC
USAGE: ${PROGRAM} [options]
@@ -299,10 +306,9 @@ while [ -n "${1}" ]; do
case "${1}" in
"--zlib-is-really-here") LIBS_ARE_HERE=1 ;;
"--libs-are-really-here") LIBS_ARE_HERE=1 ;;
- "--use-system-lws") USE_SYSTEM_LWS=1 ;;
"--use-system-protobuf")
USE_SYSTEM_PROTOBUF=1
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--without-bundled-protobuf/} --without-bundled-protobuf"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--without-bundled-protobuf}" | sed 's/$/ --without-bundled-protobuf/g')"
;;
"--dont-scrub-cflags-even-though-it-may-break-things") DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS=1 ;;
"--dont-start-it") DONOTSTART=1 ;;
@@ -322,52 +328,52 @@ while [ -n "${1}" ]; do
;;
"--stable-channel") RELEASE_CHANNEL="stable" ;;
"--nightly-channel") RELEASE_CHANNEL="nightly" ;;
- "--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-freeipmi/} --enable-plugin-freeipmi" ;;
- "--disable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-plugin-freeipmi/} --disable-plugin-freeipmi" ;;
- "--disable-https") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-https/} --disable-https" ;;
+ "--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-freeipmi)}" | sed 's/$/ --enable-plugin-freeipmi/g')" ;;
+ "--disable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-plugin-freeipmi)}" | sed 's/$/ --disable-plugin-freeipmi/g')" ;;
+ "--disable-https") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-https)}" | sed 's/$/ --disable-plugin-https/g')" ;;
"--disable-dbengine")
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-dbengine/} --disable-dbengine"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
NETDATA_DISABLE_DBENGINE=1
;;
- "--enable-plugin-nfacct") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-nfacct/} --enable-plugin-nfacct" ;;
- "--disable-plugin-nfacct") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-plugin-nfacct/} --disable-plugin-nfacct" ;;
- "--enable-plugin-xenstat") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-xenstat/} --enable-plugin-xenstat" ;;
- "--disable-plugin-xenstat") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-plugin-xenstat/} --disable-plugin-xenstat" ;;
- "--enable-backend-kinesis") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-backend-kinesis/} --enable-backend-kinesis" ;;
- "--disable-backend-kinesis") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-backend-kinesis/} --disable-backend-kinesis" ;;
- "--enable-backend-prometheus-remote-write") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-backend-prometheus-remote-write/} --enable-backend-prometheus-remote-write" ;;
+ "--enable-plugin-nfacct") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-nfacct)}" | sed 's/$/ --enable-plugin-nfacct/g')" ;;
+ "--disable-plugin-nfacct") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-plugin-nfacct)}" | sed 's/$/ --disable-plugin-nfacct/g')" ;;
+ "--enable-plugin-xenstat") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-xenstat)}" | sed 's/$/ --enable-plugin-xenstat/g')" ;;
+ "--disable-plugin-xenstat") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-plugin-xenstat)}" | sed 's/$/ --disable-plugin-xenstat/g')" ;;
+ "--enable-backend-kinesis") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-backend-kinesis)}" | sed 's/$/ --enable-backend-kinesis/g')" ;;
+ "--disable-backend-kinesis") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-backend-kinesis)}" | sed 's/$/ --disable-backend-kinesis/g')" ;;
+ "--enable-backend-prometheus-remote-write") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-backend-prometheus-remote-write)}" | sed 's/$/ --enable-backend-prometheus-remote-write/g')" ;;
"--disable-backend-prometheus-remote-write")
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-backend-prometheus-remote-write/} --disable-backend-prometheus-remote-write"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-backend-prometheus-remote-write)}" | sed 's/$/ --disable-backend-prometheus-remote-write/g')"
NETDATA_DISABLE_PROMETHEUS=1
;;
- "--enable-backend-mongodb") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-backend-mongodb/} --enable-backend-mongodb" ;;
- "--disable-backend-mongodb") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-backend-mongodb/} --disable-backend-mongodb" ;;
- "--enable-exporting-pubsub") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-exporting-pubsub/} --enable-exporting-pubsub" ;;
- "--disable-exporting-pubsub") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-exporting-pubsub/} --disable-exporting-pubsub" ;;
- "--enable-lto") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-lto/} --enable-lto" ;;
+ "--enable-backend-mongodb") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-backend-mongodb)}" | sed 's/$/ --enable-backend-mongodb/g')" ;;
+ "--disable-backend-mongodb") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-backend-mongodb)}" | sed 's/$/ --disable-backend-mongodb/g')" ;;
+ "--enable-exporting-pubsub") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-exporting-pubsub)}" | sed 's/$/ --enable-exporting-pubsub/g')" ;;
+ "--disable-exporting-pubsub") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-exporting-pubsub)}" | sed 's/$/ --disable-exporting-pubsub/g')" ;;
+ "--enable-lto") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-lto)}" | sed 's/$/ --enable-lto/g')" ;;
"--enable-ml")
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-ml/} --enable-ml"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-ml)}" | sed 's/$/ --enable-ml/g')"
NETDATA_ENABLE_ML=1
;;
"--disable-ml")
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-ml/} --disable-ml"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ml)}" | sed 's/$/ --disable-ml/g')"
NETDATA_ENABLE_ML=0
;;
- "--enable-ml-tests") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-ml-tests/} --enable-ml-tests" ;;
- "--disable-ml-tests") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-ml-tests/} --disable-ml-tests" ;;
- "--disable-lto") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-lto/} --disable-lto" ;;
- "--disable-x86-sse") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-x86-sse/} --disable-x86-sse" ;;
+ "--enable-ml-tests") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-ml-tests)}" | sed 's/$/ --enable-ml-tests/g')" ;;
+ "--disable-ml-tests") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ml-tests)}" | sed 's/$/ --disable-ml-tests/g')" ;;
+ "--disable-lto") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-lto)}" | sed 's/$/ --disable-lto/g')" ;;
+ "--disable-x86-sse") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-x86-sse)}" | sed 's/$/ --disable-x86-sse/g')" ;;
"--disable-telemetry") NETDATA_DISABLE_TELEMETRY=1 ;;
"--disable-go") NETDATA_DISABLE_GO=1 ;;
"--enable-ebpf") NETDATA_DISABLE_EBPF=0 ;;
- "--disable-ebpf") NETDATA_DISABLE_EBPF=1 NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-ebpf/} --disable-ebpf" ;;
+ "--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 ;;
"--disable-cloud")
if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then
echo "Cloud explicitly enabled, ignoring --disable-cloud."
else
NETDATA_DISABLE_CLOUD=1
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-cloud/} --disable-cloud"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-cloud)}" | sed 's/$/ --disable-cloud/g')"
fi
;;
"--require-cloud")
@@ -375,7 +381,7 @@ while [ -n "${1}" ]; do
echo "Cloud explicitly disabled, ignoring --require-cloud."
else
NETDATA_REQUIRE_CLOUD=1
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-cloud/} --enable-cloud"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-cloud)}" | sed 's/$/ --enable-cloud/g')"
fi
;;
"--build-json-c")
@@ -412,14 +418,12 @@ if [ "$(uname -s)" = "FreeBSD" ]; then
NETDATA_CONFIGURE_OPTIONS="$NETDATA_CONFIGURE_OPTIONS --disable-dependency-tracking"
fi
-# replace multiple spaces with a single space
-NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS// / }"
-
if [ "$(uname -s)" = "Linux" ] && [ -f /proc/meminfo ]; then
mega="$((1024 * 1024))"
base=1024
scale=256
+ # shellcheck disable=SC2086
if [ -n "${MAKEOPTS}" ]; then
proc_count="$(echo ${MAKEOPTS} | grep -oE '\-j *[[:digit:]]+' | tr -d '\-j ')"
else
@@ -431,7 +435,7 @@ if [ "$(uname -s)" = "Linux" ] && [ -f /proc/meminfo ]; then
total_ram="$((total_ram * 1024))"
if [ "${total_ram}" -le "$((base * mega))" ] && [ -z "${NETDATA_ENABLE_ML}" ]; then
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-ml/} --disable-ml"
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ml)}" | sed 's/$/ --disable-ml/g')"
NETDATA_ENABLE_ML=0
fi
@@ -461,9 +465,10 @@ elif echo "${MAKEOPTS}" | grep -vqF -e "-j"; then
MAKEOPTS="${MAKEOPTS} -j$(find_processors)"
fi
-if [ "${UID}" -ne 0 ]; then
+if [ "$(id -u)" -ne 0 ]; then
if [ -z "${NETDATA_PREFIX}" ]; then
- netdata_banner "wrong command line options!"
+ netdata_banner
+ progress "wrong command line options!"
banner_nonroot_install "${@}"
exit 1
else
@@ -471,7 +476,8 @@ if [ "${UID}" -ne 0 ]; then
fi
fi
-netdata_banner "real-time performance monitoring, done right!"
+netdata_banner
+progress "real-time performance monitoring, done right!"
cat << BANNER1
You are about to build and install netdata to your system.
@@ -491,7 +497,7 @@ cat << BANNER1
- log files in ${TPUT_CYAN}${NETDATA_PREFIX}/var/log/netdata${TPUT_RESET}
BANNER1
-[ "${UID}" -eq 0 ] && cat << BANNER2
+[ "$(id -u)" -eq 0 ] && cat << BANNER2
- pid file at ${TPUT_CYAN}${NETDATA_PREFIX}/var/run/netdata.pid${TPUT_RESET}
- logrotate file at ${TPUT_CYAN}/etc/logrotate.d/netdata${TPUT_RESET}
BANNER2
@@ -518,19 +524,22 @@ fi
have_autotools=
if [ "$(type autoreconf 2> /dev/null)" ]; then
autoconf_maj_min() {
- local maj min IFS=.-
-
+ OLDIFS=$IFS
+ IFS=.-
maj=$1
min=$2
+ # shellcheck disable=SC2046
set -- $(autoreconf -V | sed -ne '1s/.* \([^ ]*\)$/\1/p')
+ # shellcheck disable=SC2086
eval $maj=\$1 $min=\$2
+ IFS=$OLDIFS
}
autoconf_maj_min AMAJ AMIN
if [ "$AMAJ" -gt 2 ]; then
have_autotools=Y
- elif [ "$AMAJ" -eq 2 -a "$AMIN" -ge 60 ]; then
+ elif [ "$AMAJ" -eq 2 ] && [ "$AMIN" -ge 60 ]; then
have_autotools=Y
else
echo "Found autotools $AMAJ.$AMIN"
@@ -543,7 +552,8 @@ if [ ! "$have_autotools" ]; then
if [ -f configure ]; then
echo "Will skip autoreconf step"
else
- netdata_banner "autotools v2.60 required"
+ netdata_banner
+ progress "autotools v2.60 required"
cat << "EOF"
-------------------------------------------------------------------------------
@@ -559,11 +569,11 @@ fi
if [ ${DONOTWAIT} -eq 0 ]; then
if [ -n "${NETDATA_PREFIX}" ]; then
- echo -n "${TPUT_BOLD}${TPUT_GREEN}Press ENTER to build and install netdata to '${TPUT_CYAN}${NETDATA_PREFIX}${TPUT_YELLOW}'${TPUT_RESET} > "
+ printf '%s' "${TPUT_BOLD}${TPUT_GREEN}Press ENTER to build and install netdata to '${TPUT_CYAN}${NETDATA_PREFIX}${TPUT_YELLOW}'${TPUT_RESET} > "
else
- echo -n "${TPUT_BOLD}${TPUT_GREEN}Press ENTER to build and install netdata to your system${TPUT_RESET} > "
+ printf '%s' "${TPUT_BOLD}${TPUT_GREEN}Press ENTER to build and install netdata to your system${TPUT_RESET} > "
fi
- read -ern1
+ read -r REPLY
if [ "$REPLY" != '' ]; then
exit 1
fi
@@ -571,7 +581,8 @@ if [ ${DONOTWAIT} -eq 0 ]; then
fi
build_error() {
- netdata_banner "sorry, it failed to build..."
+ netdata_banner
+ progress "sorry, it failed to build..."
cat << EOF
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -623,26 +634,27 @@ fi
trap build_error EXIT
# -----------------------------------------------------------------------------
-
build_protobuf() {
- local env_cmd=''
+ env_cmd=''
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
env_cmd="env CFLAGS=-fPIC CXXFLAGS= LDFLAGS="
fi
- pushd "${1}" > /dev/null || return 1
+ cd "${1}" > /dev/null || return 1
+ # shellcheck disable=SC2086
if ! run ${env_cmd} ./configure --disable-shared --without-zlib --disable-dependency-tracking --with-pic; then
- popd > /dev/null || return 1
+ cd - > /dev/null || return 1
return 1
fi
+ # shellcheck disable=SC2086
if ! run ${env_cmd} $make ${MAKEOPTS}; then
- popd > /dev/null || return 1
+ cd - > /dev/null || return 1
return 1
fi
- popd > /dev/null || return 1
+ cd - > /dev/null || return 1
}
copy_protobuf() {
@@ -699,8 +711,8 @@ bundle_protobuf
# -----------------------------------------------------------------------------
build_judy() {
- local env_cmd=''
- local libtoolize="libtoolize"
+ env_cmd=''
+ libtoolize="libtoolize"
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
env_cmd="env CFLAGS=-fPIC CXXFLAGS= LDFLAGS="
@@ -710,7 +722,8 @@ build_judy() {
libtoolize="glibtoolize"
fi
- pushd "${1}" > /dev/null || return 1
+ cd "${1}" > /dev/null || return 1
+ # shellcheck disable=SC2086
if run ${env_cmd} ${libtoolize} --force --copy &&
run ${env_cmd} aclocal &&
run ${env_cmd} autoheader &&
@@ -719,9 +732,9 @@ build_judy() {
run ${env_cmd} ./configure &&
run ${env_cmd} ${make} ${MAKEOPTS} -C src &&
run ${env_cmd} ar -r src/libJudy.a src/Judy*/*.o; then
- popd > /dev/null || return 1
+ cd - > /dev/null || return 1
else
- popd > /dev/null || return 1
+ cd - > /dev/null || return 1
return 1
fi
}
@@ -793,18 +806,19 @@ bundle_judy() {
bundle_judy
# -----------------------------------------------------------------------------
-
build_jsonc() {
- local env_cmd=''
+ env_cmd=''
if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
env_cmd="env CFLAGS=-fPIC CXXFLAGS= LDFLAGS="
fi
- pushd "${1}" > /dev/null || exit 1
+ 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}
- popd > /dev/null || exit 1
+ cd - > /dev/null || exit 1
}
copy_jsonc() {
@@ -813,6 +827,7 @@ copy_jsonc() {
run mkdir -p "${target_dir}" "${target_dir}/json-c" || return 1
run cp "${1}/libjson-c.a" "${target_dir}/libjson-c.a" || return 1
+ # shellcheck disable=SC2086
run cp ${1}/*.h "${target_dir}/json-c" || return 1
}
@@ -866,9 +881,14 @@ bundle_jsonc
get_kernel_version() {
r="$(uname -r | cut -f 1 -d '-')"
- read -r -a p <<< "$(echo "${r}" | tr '.' ' ')"
+ tmpfile="$(mktemp)"
+ echo "${r}" | tr '.' ' ' > "${tmpfile}"
+
+ read -r maj min patch _ < "${tmpfile}"
+
+ rm -f "${tmpfile}"
- printf "%03d%03d%03d" "${p[0]}" "${p[1]}" "${p[2]}"
+ printf "%03d%03d%03d" "${maj}" "${min}" "${patch}"
}
rename_libbpf_packaging() {
@@ -883,10 +903,11 @@ rename_libbpf_packaging() {
build_libbpf() {
- pushd "${1}/src" > /dev/null || exit 1
+ cd "${1}/src" > /dev/null || exit 1
mkdir root build
+ # shellcheck disable=SC2086
run env CFLAGS=-fPIC CXXFLAGS= LDFLAGS= BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=.. ${make} ${MAKEOPTS} install
- popd > /dev/null || exit 1
+ cd - > /dev/null || exit 1
}
copy_libbpf() {
@@ -981,6 +1002,7 @@ if [ "$have_autotools" ]; then
run autoreconf -ivf || exit 1
fi
+# shellcheck disable=SC2086
run ./configure \
--prefix="${NETDATA_PREFIX}/usr" \
--sysconfdir="${NETDATA_PREFIX}/etc" \
@@ -1008,6 +1030,7 @@ run $make clean
# -----------------------------------------------------------------------------
progress "Compile netdata"
+# shellcheck disable=SC2086
run $make ${MAKEOPTS} || exit 1
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
@@ -1029,7 +1052,7 @@ if [ -d "${NETDATA_PREFIX}/etc/netdata" ]; then
# 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}" -a ! -f "${NETDATA_PREFIX}/etc/netdata/charts.d/${x}.conf${y}" ]; then
+ 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
@@ -1042,7 +1065,7 @@ if [ -d "${NETDATA_PREFIX}/etc/netdata" ]; then
# move the node.d config files
for x in named sma_webbox snmp; do
for y in "" ".old" ".orig"; do
- if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" -a ! -f "${NETDATA_PREFIX}/etc/netdata/node.d/${x}.conf${y}" ]; then
+ if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" ] && [ ! -f "${NETDATA_PREFIX}/etc/netdata/node.d/${x}.conf${y}" ]; then
run mv -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" "${NETDATA_PREFIX}/etc/netdata/node.d/${x}.conf${y}"
fi
done
@@ -1059,20 +1082,9 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
progress "Backup existing netdata configuration before installing it"
- if [ "${BASH_VERSINFO[0]}" -ge "4" ]; then
- declare -A configs_signatures=()
- if [ -f "configs.signatures" ]; then
- source "configs.signatures" || echo >&2 "ERROR: Failed to load configs.signatures !"
- fi
- fi
-
config_signature_matches() {
- local md5="${1}" file="${2}"
-
- if [ "${BASH_VERSINFO[0]}" -ge "4" ]; then
- [ "${configs_signatures[${md5}]}" = "${file}" ] && return 0
- return 1
- fi
+ md5="${1}"
+ file="${2}"
if [ -f "configs.signatures" ]; then
grep "\['${md5}'\]='${file}'" "configs.signatures" > /dev/null
@@ -1083,18 +1095,18 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
}
# clean up stock config files from the user configuration directory
- while IFS= read -r -d '' x; do
+ (find -L "${NETDATA_PREFIX}/etc/netdata" -type f -not -path '*/\.*' -not -path "${NETDATA_PREFIX}/etc/netdata/orig/*" \( -name '*.conf.old' -o -name '*.conf' -o -name '*.conf.orig' -o -name '*.conf.installer_backup.*' \)) | while IFS= read -r x; do
if [ -f "${x}" ]; then
# find it relative filename
- f="${x/${NETDATA_PREFIX}\/etc\/netdata\//}"
+ f=$("$x" | sed "${NETDATA_PREFIX}/etc/netdata/")
# find the stock filename
- t="${f/.conf.installer_backup.*/.conf}"
- t="${t/.conf.old/.conf}"
- t="${t/.conf.orig/.conf}"
- t="${t/orig\//}"
+ t=$("${f}" | sed ".conf.installer_backup.*/.conf")
+ t=$("${t}" | sed ".conf.old/.conf")
+ t=$("${t}" | sed ".conf.orig/.conf")
+ t=$("${t}" | sed "orig//")
- if [ -z "${md5sum}" -o ! -x "${md5sum}" ]; then
+ if [ -z "${md5sum}" ] || [ ! -x "${md5sum}" ]; then
# we don't have md5sum - keep it
echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RED}is not known to distribution${TPUT_RESET}. Keeping it."
else
@@ -1102,9 +1114,10 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
md5="$(${md5sum} < "${x}" | cut -d ' ' -f 1)"
if config_signature_matches "${md5}" "${t}"; then
- # it is a stock version - remove it
+ # it is a stock version - remove it
echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' is stock version of '${t}'."
run rm -f "${x}"
+ # shellcheck disable=SC2030
deleted_stock_configs=$((deleted_stock_configs + 1))
else
# edited by user - keep it
@@ -1112,7 +1125,7 @@ if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-don
fi
fi
fi
- done < <(find -L "${NETDATA_PREFIX}/etc/netdata" -type f -not -path '*/\.*' -not -path "${NETDATA_PREFIX}/etc/netdata/orig/*" \( -name '*.conf.old' -o -name '*.conf' -o -name '*.conf.orig' -o -name '*.conf.installer_backup.*' \))
+ done
fi
touch "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-done"
@@ -1131,7 +1144,7 @@ progress "Creating standard user and groups for netdata"
NETDATA_WANTED_GROUPS="docker nginx varnish haproxy adm nsd proxy squid ceph nobody"
NETDATA_ADDED_TO_GROUPS=""
-if [ "${UID}" -eq 0 ]; then
+if [ "$(id -u)" -eq 0 ]; then
progress "Adding group 'netdata'"
portable_add_group netdata || :
@@ -1161,7 +1174,9 @@ progress "Read installation options from netdata.conf"
# function to extract values from the config file
config_option() {
- local section="${1}" key="${2}" value="${3}"
+ section="${1}"
+ key="${2}"
+ value="${3}"
if [ -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]; then
"${NETDATA_PREFIX}/usr/sbin/netdata" \
@@ -1174,7 +1189,7 @@ config_option() {
}
# the user netdata will run as
-if [ "${UID}" = "0" ]; then
+if [ "$(id -u)" = "0" ]; then
NETDATA_USER="$(config_option "global" "run as user" "netdata")"
ROOT_USER="root"
else
@@ -1188,7 +1203,7 @@ echo >&2 "Netdata user and group is finally set to: ${NETDATA_USER}/${NETDATA_GR
# the owners of the web files
NETDATA_WEB_USER="$(config_option "web" "web files owner" "${NETDATA_USER}")"
NETDATA_WEB_GROUP="${NETDATA_GROUP}"
-if [ "${UID}" = "0" ] && [ "${NETDATA_USER}" != "${NETDATA_WEB_USER}" ]; then
+if [ "$(id -u)" = "0" ] && [ "${NETDATA_USER}" != "${NETDATA_WEB_USER}" ]; then
NETDATA_WEB_GROUP="$(id -g -n "${NETDATA_WEB_USER}")"
[ -z "${NETDATA_WEB_GROUP}" ] && NETDATA_WEB_GROUP="${NETDATA_WEB_USER}"
fi
@@ -1244,6 +1259,7 @@ fi
[ ! -d "${NETDATA_STOCK_CONFIG_DIR}" ] && mkdir -p "${NETDATA_STOCK_CONFIG_DIR}"
helplink="000.-.USE.THE.orig.LINK.TO.COPY.AND.EDIT.STOCK.CONFIG.FILES"
+# shellcheck disable=SC2031
[ ${deleted_stock_configs} -eq 0 ] && helplink=""
for link in "orig" "${helplink}"; do
if [ -n "${link}" ]; then
@@ -1288,7 +1304,7 @@ run chmod 770 "${NETDATA_CLAIMING_DIR}"
# --- plugins ----
-if [ "${UID}" -eq 0 ]; then
+if [ "$(id -u)" -eq 0 ]; then
# find the admin group
admin_group=
test -z "${admin_group}" && getent group root > /dev/null 2>&1 && admin_group="root"
@@ -1299,6 +1315,7 @@ if [ "${UID}" -eq 0 ]; then
run chown -R "root:${admin_group}" "${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 {} \;
+ # shellcheck disable=SC2086
run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.plugin -exec chown :${NETDATA_GROUP} {} \;
run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.plugin -exec chmod 0750 {} \;
run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.sh -exec chmod 0755 {} \;
@@ -1331,29 +1348,29 @@ if [ "${UID}" -eq 0 ]; then
fi
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/xenstat.plugin" ]; then
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/xenstat.plugin"
+ run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/xenstat.plugin"
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/xenstat.plugin"
fi
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin" ]; then
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
+ run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
run sh -c "setcap cap_perfmon+ep \"${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin\" || setcap cap_sys_admin+ep \"${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin\""
fi
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/slabinfo.plugin" ]; then
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/slabinfo.plugin"
+ run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/slabinfo.plugin"
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/slabinfo.plugin"
run setcap cap_dac_read_search+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/slabinfo.plugin"
fi
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ioping" ]; then
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ioping"
+ run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ioping"
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ioping"
fi
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf.plugin" ]; then
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf.plugin"
+ run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf.plugin"
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf.plugin"
fi
@@ -1383,6 +1400,8 @@ fi
# 1 - version1 > version2
# 2 - version2 > version1
# 3 - error
+
+# shellcheck disable=SC2086
govercomp() {
# version in file:
# - v0.14.0
@@ -1395,23 +1414,26 @@ govercomp() {
# - go.d.plugin, version: v0.14.1-1-g4c5f98c-dirty
# we need to compare only MAJOR.MINOR.PATCH part
- local ver1 ver2
ver1=$(echo "$1" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+")
ver2=$(echo "$2" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+")
- local IFS=.
- read -ra ver1 <<< "$ver1"
- read -ra ver2 <<< "$ver2"
-
- if [ ${#ver1[@]} -eq 0 ] || [ ${#ver2[@]} -eq 0 ]; then
+ if [ ${#ver1} -eq 0 ] || [ ${#ver2} -eq 0 ]; then
return 3
fi
- local i
- for ((i = 0; i < ${#ver1[@]}; i++)); do
- if [ "${ver1[i]}" -gt "${ver2[i]}" ]; then
+ num1=$(echo $ver1 | grep -o -E '\.' | wc -l)
+ num2=$(echo $ver2 | grep -o -E '\.' | wc -l)
+
+ if [ ${num1} -ne ${num2} ]; then
+ return 3
+ fi
+
+ for i in $(seq 1 $((num1+1))); do
+ x=$(echo $ver1 | cut -d'.' -f$i)
+ y=$(echo $ver2 | cut -d'.' -f$i)
+ if [ "${x}" -gt "${y}" ]; then
return 1
- elif [ "${ver2[i]}" -gt "${ver1[i]}" ]; then
+ elif [ "${y}" -gt "${x}" ]; then
return 2
fi
done
@@ -1424,9 +1446,6 @@ should_install_go() {
return 1
fi
- local version_in_file
- local binary_version
-
version_in_file="$(cat packaging/go.d.version 2> /dev/null)"
binary_version=$("${NETDATA_PREFIX}"/usr/libexec/netdata/plugins.d/go.d.plugin -v 2> /dev/null)
@@ -1447,22 +1466,22 @@ install_go() {
# When updating this value, ensure correct checksums in packaging/go.d.checksums
GO_PACKAGE_VERSION="$(cat packaging/go.d.version)"
- ARCH_MAP=(
- 'i386::386'
- 'i686::386'
- 'x86_64::amd64'
- 'aarch64::arm64'
- 'armv64::arm64'
- 'armv6l::arm'
- 'armv7l::arm'
- 'armv5tel::arm'
- )
+ ARCH_MAP='
+ i386::386
+ i686::386
+ x86_64::amd64
+ aarch64::arm64
+ armv64::arm64
+ armv6l::arm
+ armv7l::arm
+ armv5tel::arm
+ '
progress "Install go.d.plugin"
ARCH=$(uname -m)
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
- for index in "${ARCH_MAP[@]}"; do
+ for index in ${ARCH_MAP}; do
KEY="${index%%::*}"
VALUE="${index##*::}"
if [ "$KEY" = "$ARCH" ]; then
@@ -1518,9 +1537,9 @@ install_go() {
run tar -xf "${tmp}/config.tar.gz" -C "${NETDATA_STOCK_CONFIG_DIR}/"
run chown -R "${ROOT_USER}:${ROOT_GROUP}" "${NETDATA_STOCK_CONFIG_DIR}"
- run tar xf "${tmp}/${GO_PACKAGE_BASENAME}"
- run mv "${GO_PACKAGE_BASENAME/\.tar\.gz/}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
- if [ "${UID}" -eq 0 ]; then
+ run tar -xf "${tmp}/${GO_PACKAGE_BASENAME}"
+ run mv "${GO_PACKAGE_BASENAME%.tar.gz}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
+ if [ "$(id -u)" -eq 0 ]; then
run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
fi
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
@@ -1705,7 +1724,7 @@ if grep -q docker /proc/1/cgroup > /dev/null 2>&1; then
is_systemd_running="$( (pgrep -q -f systemd && echo "1") || echo "NO")"
fi
- if [ "${is_systemd_running}" == "1" ]; then
+ if [ "${is_systemd_running}" = "1" ]; then
echo >&2 "Found systemd within the docker container, running install_netdata_service() method"
install_netdata_service || run_failed "Cannot install netdata init service."
else
@@ -1803,7 +1822,7 @@ if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" ]; then
# -----------------------------------------------------------------------------
progress "Check apps.plugin"
- if [ "${UID}" -ne 0 ]; then
+ if [ "$(id -u)" -ne 0 ]; then
cat << SETUID_WARNING
${TPUT_BOLD}apps.plugin needs privileges${TPUT_RESET}
@@ -1838,8 +1857,8 @@ if [ -f "${NETDATA_PREFIX}"/usr/libexec/netdata-uninstaller.sh ]; then
rm -f "${NETDATA_PREFIX}"/usr/libexec/netdata-uninstaller.sh
fi
-sed "s|ENVIRONMENT_FILE=\"/etc/netdata/.environment\"|ENVIRONMENT_FILE=\"${NETDATA_PREFIX}/etc/netdata/.environment\"|" packaging/installer/netdata-uninstaller.sh > ${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh
-chmod 750 ${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh
+sed "s|ENVIRONMENT_FILE=\"/etc/netdata/.environment\"|ENVIRONMENT_FILE=\"${NETDATA_PREFIX}/etc/netdata/.environment\"|" packaging/installer/netdata-uninstaller.sh > "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh"
+chmod 750 "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-uninstaller.sh"
# -----------------------------------------------------------------------------
progress "Basic netdata instructions"
@@ -1870,7 +1889,7 @@ install_netdata_updater || run_failed "Cannot install netdata updater tool."
progress "Check if we must enable/disable the netdata updater tool"
if [ "${AUTOUPDATE}" = "1" ]; then
- enable_netdata_updater ${AUTO_UPDATE_TYPE} || run_failed "Cannot enable netdata updater tool"
+ enable_netdata_updater "${AUTO_UPDATE_TYPE}" || run_failed "Cannot enable netdata updater tool"
else
disable_netdata_updater || run_failed "Cannot disable netdata updater tool"
fi
@@ -1890,7 +1909,7 @@ NETDATA_TMPDIR="${TMPDIR}"
NETDATA_PREFIX="${NETDATA_PREFIX}"
NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS}"
NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS}"
-INSTALL_UID="${UID}"
+INSTALL_UID="$(id -u)"
NETDATA_GROUP="${NETDATA_GROUP}"
REINSTALL_OPTIONS="${REINSTALL_OPTIONS}"
RELEASE_CHANNEL="${RELEASE_CHANNEL}"
@@ -1911,9 +1930,11 @@ echo >&2
progress "We are done!"
if [ ${started} -eq 1 ]; then
- netdata_banner "is installed and running now!"
+ netdata_banner
+ progress "is installed and running now!"
else
- netdata_banner "is installed now!"
+ netdata_banner
+ progress "is installed now!"
fi
echo >&2 " enjoy real-time performance and health monitoring..."
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index bd9ca39b56..56f1a56585 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -1,10 +1,9 @@
-#!/bin/bash
+#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
# make sure we have a UID
[ -z "${UID}" ] && UID="$(id -u)"
-
# -----------------------------------------------------------------------------
setup_terminal() {
@@ -51,6 +50,7 @@ setup_terminal() {
TPUT_BLUE="$(tput setaf 4)"
# shellcheck disable=SC2034
TPUT_PURPLE="$(tput setaf 5)"
+ # shellcheck disable=SC2034
TPUT_CYAN="$(tput setaf 6)"
TPUT_WHITE="$(tput setaf 7)"
# shellcheck disable=SC2034
@@ -129,11 +129,11 @@ download_file() {
# external component handling<