mirror of
https://github.com/netdata/netdata.git
synced 2025-04-13 09:11:50 +00:00
Fix issues with $PATH and netdatacli detection. (#19371)
- 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:
parent
80e6a6028a
commit
db31a10503
1 changed files with 20 additions and 2 deletions
|
@ -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 don’t include sbin directories for regular
|
||||
# users (even though the distinction is all but pointless at this point in
|
||||
# time), and a number of distros don’t 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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue