0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-13 09:11:50 +00:00

Fix issues with $PATH and netdatacli detection. ()

- Account for Debian/Ubuntu still not including sbin directories in user
  $PATH.
- Report an inability to detect netdatacli location instead of trying to
  invoke an empty string when claiming.
This commit is contained in:
Austin S. Hemmelgarn 2025-01-13 10:04:20 -05:00 committed by GitHub
parent 80e6a6028a
commit db31a10503
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,12 +20,26 @@ KICKSTART_SOURCE="$(
echo "$(pwd -P)/${self##*/}"
)"
DEFAULT_PLUGIN_PACKAGES=""
PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
REPOCONFIG_DEB_VERSION="4-1"
REPOCONFIG_RPM_VERSION="4-1"
START_TIME="$(date +%s)"
STATIC_INSTALL_ARCHES="x86_64 armv7l armv6l aarch64 ppc64le"
# ======================================================================
# Properly sort out inconsistencies in `$PATH` across distros
#
# Debian and Ubuntu still dont include sbin directories for regular
# users (even though the distinction is all but pointless at this point in
# time), and a number of distros dont include the standard paths under
# `/usr/local` either.
for dir in /usr/sbin /sbin /usr/local/bin /usr/local/sbin ; do
case ":${PATH}:" in
*:${dir}:*) ;;
*) PATH="${PATH}:${dir}" ;;
esac
done
# ======================================================================
# URLs used throughout the script
@ -1279,7 +1293,11 @@ write_claim_config() {
run_as_root mv -f "${claim_config}.tmp" "${claim_config}" || return 1
if [ -z "${NETDATA_CLAIM_NORELOAD}" ]; then
run_as_root "${netdatacli}" reload-claiming-state || return 1
if [ -n "${netdatacli}" ]; then
run_as_root "${netdatacli}" reload-claiming-state || return 1
else
warning "Unable to find the netdatacli binary, the agent must be restarted to finish claiming"
fi
fi
}