Fix logic in detection of multiple installs. (#17369)
- Only flag multiple installs if subsequent searches produce a different install path. - Only set the detected install path if a search actually finds an install path. - Bail early if the initial search finds nothing.
Austin S. Hemmelgarn committed
Apr 10, 2024 at 13:08 UTC
2293a52b7e86353e83dcaf400093cc76795e2fe3
1 file changed
+4
-2
packaging/installer/kickstart.sh
+4
-2
@@ -886,14 +886,16 @@ detect_existing_install() {
886
while [ -n "${searchpath}" ]; do
887
_ndpath="$(PATH="${searchpath}" command -v netdata 2>/dev/null)"
888
889
- if [ -z "${ndpath}" ]; then
889
+ if [ -z "${ndpath}" ] && [ -n "${_ndpath}" ]; then
890
ndpath="${_ndpath}"
891
- elif [ -n "${_ndpath}" ]; then
891
+ elif [ -n "${_ndpath}" ] && [ "${ndpath}" != "${_ndpath}" ]; then
892
fatal "Multiple installs of Netdata agent detected (located at '${ndpath}' and '${_ndpath}'). Such a setup is not generally supported. If you are certain you want to operate on one of them despite this, use the '--install-prefix' option to specifiy the install you want to operate on." F0517
893
fi
894
895
if [ -n "${INSTALL_PREFIX}" ] && [ -n "${ndpath}" ]; then
896
break
897
+ elif [ -z "${_ndpath}" ]; then
898
+ break
899
elif echo "${searchpath}" | grep -v ':'; then
900
searchpath=""
901
else