Skip to content

Commit

Permalink
Fix issues with $PATH and netdatacli detection. (netdata#19371)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Ferroin authored Jan 13, 2025
1 parent 80e6a60 commit db31a10
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packaging/installer/kickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit db31a10

Please sign in to comment.