Add proper handling for legacy kickstart install detection. (#12273)
* Add proper handling for legacy kickstart install detection. By properly looking for and parsing the `.environment` file if we do not see a `.install-type` file. * Update packaging/installer/kickstart.sh Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud> * Add handling for incorrect `custom` install types. Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Austin S. Hemmelgarn committed
Mar 3, 2022 at 07:51 UTC
3447ddec607ed7ca624829ff4f34181fa76c103d
1 file changed
+16
packaging/installer/kickstart.sh
+16
@@ -584,6 +584,7 @@ detect_existing_install() {
584
585
if [ -n "${ndprefix}" ]; then
586
typefile="${ndprefix}/etc/netdata/.install-type"
587
+ envfile="${ndprefix}/etc/netdata/.environment"
588
if [ -r "${typefile}" ]; then
589
${ROOTCMD} sh -c "cat \"${typefile}\" > \"${tmpdir}/install-type\""
590
# shellcheck disable=SC1090,SC1091
@@ -591,6 +592,21 @@ detect_existing_install() {
592
else
593
INSTALL_TYPE="unknown"
594
fi
595
+
596
+ if [ "${INSTALL_TYPE}" = "unknown" ] || [ "${INSTALL_TYPE}" = "custom" ]; then
597
+ if [ -r "${envfile}" ]; then
598
+ ${ROOTCMD} sh -c "cat \"${envfile}\" > \"${tmpdir}/environment\""
599
+ # shellcheck disable=SC1091
600
+ . "${tmpdir}/environment"
601
+ if [ -n "${NETDATA_IS_STATIC_INSTALL}" ]; then
602
+ if [ "${NETDATA_IS_STATIC_INSTALL}" = "yes" ]; then
603
+ INSTALL_TYPE="legacy-static"
604
+ else
605
+ INSTALL_TYPE="legacy-build"
606
+ fi
607
+ fi
608
+ fi
609
+ fi
610
fi
611
}
612