#!/bin/sh# SPDX-License-Identifier: GPL-3.0-or-later# Next unused error code: I0012exportPATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
uniquepath(){path=""tmp="$(mktemp)"(echo"${PATH}"|tr":""\n")>"$tmp"whileread-rREPLY;doifecho"${path}"|grep-v"(^|:)${REPLY}(:|$)";then[-n"${path}"]&&path="${path}:"path="${path}${REPLY}"fidone<"$tmp"
rm"$tmp"[-n"${path}"]exportPATH="${path%:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin}"}>/dev/null
uniquepath
PROGRAM="$0"NETDATA_SOURCE_DIR="$(pwd)"INSTALLER_DIR="$(dirname"${PROGRAM}")"if["${NETDATA_SOURCE_DIR}"!="${INSTALLER_DIR}"]&&["${INSTALLER_DIR}"!="."];thenecho>&2"Warning: you are currently in '${NETDATA_SOURCE_DIR}' but the installer is in '${INSTALLER_DIR}'."fi# -----------------------------------------------------------------------------# reload the user profile# shellcheck source=/dev/null[-f/etc/profile]&&./etc/profile
# make sure /etc/profile does not change our current directorycd"${NETDATA_SOURCE_DIR}"||exit1# -----------------------------------------------------------------------------# load the required functionsif[-f"${INSTALLER_DIR}/packaging/installer/functions.sh"];then# shellcheck source=packaging/installer/functions.sh."${INSTALLER_DIR}/packaging/installer/functions.sh"||exit1else# shellcheck source=packaging/installer/functions.sh."${NETDATA_SOURCE_DIR}/packaging/installer/functions.sh"||exit1fi# Used to enable saved warnings support in functions.sh# shellcheck disable=SC2034