@cryptotaxi247 / netdata-1 / commits / d641a3bdd

Detect in kickstart script if we publish native packages for the platform (#21262)

* Detect in kickstart script if we publish native packages for the platform. This allows more intelligent fallback behavior, insisting on using native packages if they are being published (and are actually available) and only falling back if they aren’t. It also means that users installing on platforms we still have packages available for but no longer publish packages for will end up with static installs instead of native package installs. This change includes a new option for the kickstart script called `--install-type`, which can be used to specify the install type to use. It supports five possible values currently, `native`, `static`, `build`, `auto`, and `any`. The first three are equivalent to the existing `--native-only`, `--static-only`, and `--build-only` options. The `any` value indicates to use our existing fallback behavior (try each install type in order until we find one that works). The `auto` value, which is the new default, acts like `native` if the script detects that we publish native packages for the platform, and `any` otherwise. This is dependent on a flag file on the repository server that is generated by our package upload processing code for platforms that we publish native packages for. * Add more comprehensive checking. With this change, the script now also checks for the presence of repository metadata for the repository that would be used to install Netdata. If the other checks pass but this one fails, a different error message is show indicating that packages aren’t available yet, but will be soon, with the stable install message providing info on how to install anyway. * Actually add --install-type option. * Improve error message. * Fix early bail-out cases for native package installs. They need to defer instead of failing outright when running in auto mode. Also, fix the exit code for `--repositories-only` installs. * Fix incorrect error message. * Fix error messages.

Austin S. Hemmelgarn committed Dec 1, 2025 at 08:16 UTC d641a3bdd39e4a1b852a791cfa7385ef281e8b30
1 file changed +90 -44
packaging/installer/kickstart.sh
+90 -44
@@ -2,7 +2,7 @@
2 #
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 #
5 -# Next unused error code: F051B
5 +# Next unused error code: F0520
6
7 # ======================================================================
8 # Constants
@@ -53,8 +53,9 @@ INSTALL_DOC_URL="https://learn.netdata.cloud/docs/install-the-netdata-agent/one-
53 PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
54 PUBLIC_CLOUD_URL="https://app.netdata.cloud"
55 RELEASE_INFO_URL="https://repo.netdata.cloud/releases"
56 -REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig"
57 -REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig"
56 +STABLE_REPO_URL_PREFIX="https://repository.netdata.cloud/repos/stable"
57 +NIGHTLY_REPO_URL_PREFIX="https://repository.netdata.cloud/repos/edge"
58 +REPOCONFIG_URL_PREFIX="https://repository.netdata.cloud/repos/repoconfig"
59 TELEMETRY_URL="https://us-east1-netdata-analytics-bi.cloudfunctions.net/ingest_agent_events"
60
61 # ======================================================================
@@ -68,7 +69,7 @@ NETDATA_AUTO_UPDATES="default"
69 NETDATA_CLAIM_URL="https://app.netdata.cloud"
70 NETDATA_COMMAND="default"
71 NETDATA_INSTALLER_OPTIONS=""
71 -NETDATA_FORCE_METHOD=""
72 +NETDATA_REQUESTED_INSTALL_TYPE="auto"
73 NETDATA_OFFLINE_INSTALL_SOURCE=""
74 NETDATA_WARNINGS=""
75 RELEASE_CHANNEL="default"
@@ -84,7 +85,7 @@ fi
85 NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://github.com/netdata/netdata-nightlies/releases}"
86
87 if echo "${0}" | grep -q 'kickstart-static64'; then
87 - NETDATA_FORCE_METHOD='static'
88 + NETDATA_REQUESTED_INSTALL_TYPE='static'
89 fi
90
91 if [ ! -t 1 ]; then
@@ -195,6 +196,7 @@ USAGE: kickstart.sh [options]
196 --native-only Only install if native binary packages are available.
197 --static-only Only install if a static build is available.
198 --build-only Only install using a local build.
199 + --install-type <type> Specify what installation type to use (native, static, build, auto, or any).
200 --install-prefix <path> Specify an installation prefix for local builds (default: autodetect based on system type).
201 --old-install-prefix <path> Specify an old local builds installation prefix for uninstall/reinstall (if it's not default).
202 --install-version <version> Specify the version of Netdata to install.
@@ -1087,9 +1089,9 @@ handle_existing_install() {
1089 progress "Found an existing netdata install at ${ndprefix}, but user requested reinstall, continuing."
1090
1091 case "${INSTALL_TYPE}" in
1090 - binpkg-*) NETDATA_FORCE_METHOD='native' ;;
1091 - *-build) NETDATA_FORCE_METHOD='build' ;;
1092 - *-static) NETDATA_FORCE_METHOD='static' ;;
1092 + binpkg-*) NETDATA_REQUESTED_INSTALL_TYPE='native' ;;
1093 + *-build) NETDATA_REQUESTED_INSTALL_TYPE='build' ;;
1094 + *-static) NETDATA_REQUESTED_INSTALL_TYPE='static' ;;
1095 *)
1096 if [ "${ACTION}" = "unsafe-reinstall" ]; then
1097 warning "Reinstalling over top of a ${INSTALL_TYPE} installation may be unsafe, but the user has requested we proceed."
@@ -1198,7 +1200,7 @@ handle_existing_install() {
1200 }
1201
1202 confirm_install_prefix() {
1201 - if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_FORCE_METHOD}" != 'build' ]; then
1203 + if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'build' ]; then
1204 fatal "The --install-prefix option is only supported together with the --build-only option." F0204
1205 fi
1206
@@ -1616,12 +1618,12 @@ try_package_install() {
1618
1619 if [ -z "${DISTRO_COMPAT_NAME}" ] || [ "${DISTRO_COMPAT_NAME}" = "unknown" ]; then
1620 warning "Unable to determine Linux distribution for native packages."
1619 - return 2
1621 + return 3
1622 elif [ -z "${SYSCODENAME}" ]; then
1623 case "${DISTRO_COMPAT_NAME}" in
1624 debian|ubuntu)
1625 warning "Release codename not set. Unable to check availability of native packages for this system."
1624 - return 2
1626 + return 3
1627 ;;
1628 esac
1629 fi
@@ -1703,7 +1705,7 @@ try_package_install() {
1705 ;;
1706 *)
1707 warning "We do not provide native packages for ${DISTRO}."
1706 - return 2
1708 + return 3
1709 ;;
1710 esac
1711
@@ -1723,27 +1725,47 @@ try_package_install() {
1725
1726 repoconfig_name="netdata-repo${release}"
1727
1728 + case "${SELECTED_RELEASE_CHANNEL}" in
1729 + stable) REPO_URL_PREFIX="${STABLE_REPO_URL_PREFIX}" ;;
1730 + nightly) REPO_URL_PREFIX="${NIGHTLY_REPO_URL_PREFIX}" ;;
1731 + esac
1732 +
1733 case "${pkg_type}" in
1734 deb)
1735 repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_DEB_VERSION}${pkg_suffix}.${pkg_type}"
1729 - repoconfig_url="${REPOCONFIG_DEB_URL_PREFIX}/${repo_prefix}/${repoconfig_file}"
1730 - ref_check_url="${REPOCONFIG_DEB_URL_PREFIX}"
1736 + repoconfig_url="${REPOCONFIG_URL_PREFIX}/${repo_prefix}/${repoconfig_file}"
1737 + ref_check_url="${REPOCONFIG_URL_PREFIX}"
1738 + pub_check_url="${REPO_URL_PREFIX}/${repo_prefix}/.currently.published"
1739 + pkg_meta_url="${REPO_URL_PREFIX}/${repo_prefix}/InRelease"
1740 ;;
1741 rpm)
1742 repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_RPM_VERSION}${pkg_suffix}.${pkg_type}"
1734 - repoconfig_url="${REPOCONFIG_RPM_URL_PREFIX}/${repo_prefix}/${SYSARCH}/${repoconfig_file}"
1735 - ref_check_url="${REPOCONFIG_RPM_URL_PREFIX}"
1743 + repoconfig_url="${REPOCONFIG_URL_PREFIX}/${repo_prefix}/${SYSARCH}/${repoconfig_file}"
1744 + ref_check_url="${REPOCONFIG_URL_PREFIX}"
1745 + pub_check_url="${REPO_URL_PREFIX}/${repo_prefix}/${SYSARCH}/.currently.published"
1746 + pkg_meta_url="${REPO_URL_PREFIX}/${repo_prefix}/${SYSARCH}/repodata/repomd.xml"
1747 ;;
1748 esac
1749
1739 - progress "Checking for availability of repository configuration package."
1750 if ! check_for_remote_file "${ref_check_url}"; then
1751 NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1
1752 fi
1753
1754 + progress "Checking if native packages are being published for this platform."
1755 + if ! check_for_remote_file "${pub_check_url}"; then
1756 + warning "Native packages are not being published for this system."
1757 + return 3
1758 + fi
1759 +
1760 + if ! check_for_remote_file "${pkg_meta_url}"; then
1761 + warning "Native packages have not yet been published for this system."
1762 + return 4
1763 + fi
1764 +
1765 + progress "Checking for availability of repository configuration package."
1766 if ! check_for_remote_file "${repoconfig_url}"; then
1767 warning "No repository configuration package available for ${DISTRO} ${SYSVERSION}. Cannot install native packages on this system."
1746 - return 2
1768 + return 3
1769 fi
1770
1771 if ! download "${repoconfig_url}" "${tmpdir}/${repoconfig_file}"; then
@@ -1783,7 +1805,7 @@ try_package_install() {
1805 deferred_warnings
1806 cleanup
1807 trap - EXIT
1786 - exit 1
1808 + exit 0
1809 fi
1810
1811 if ! check_special_native_deps; then
@@ -2125,8 +2147,8 @@ prepare_offline_install_source() {
2147
2148 run cd "${1}" || fatal "Failed to switch to target directory for offline install preparation." F0505
2149
2128 - case "${NETDATA_FORCE_METHOD}" in
2129 - static|'')
2150 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2151 + static|auto|any)
2152 set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "x86_64"
2153
2154 if ! check_for_remote_file "${NETDATA_TARBALL_BASEURL}"; then
@@ -2166,6 +2188,7 @@ prepare_offline_install_source() {
2188 fatal "Failed to download checksum file. ${BADNET_MSG}." F0506
2189 fi
2190 ;;
2191 + *) fatal "Install type ${NETDATA_REQUESTED_INSTALL_TYPE} is not supported for offline installs." F051B
2192 esac
2193
2194 if [ "${legacy:-0}" -eq 1 ]; then
@@ -2224,7 +2247,7 @@ prepare_offline_install_source() {
2247 # Per system-type install logic
2248
2249 install_on_linux() {
2227 - if [ "${NETDATA_FORCE_METHOD}" != 'static' ] && [ "${NETDATA_FORCE_METHOD}" != 'build' ] && [ -z "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then
2250 + if [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'static' ] && [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'build' ] && [ -z "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then
2251 SELECTED_INSTALL_METHOD="native"
2252 try_package_install
2253
@@ -2235,15 +2258,31 @@ install_on_linux() {
2258 ;;
2259 1) fatal "Unable to install on this system." F0300 ;;
2260 2)
2238 - case "${NETDATA_FORCE_METHOD}" in
2239 - native) fatal "Could not install native binary packages." F0301 ;;
2240 - *) warning "Could not install native binary packages, falling back to alternative installation method." ;;
2261 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2262 + native|auto) fatal "Could not install using native binary packages even though they appear to be available. This usually means something is wrong with your system package manager that requires manual intervention to fix. If you want to install anyway without using native packages, re-run this script with the option '--install-type any'" F0301 ;;
2263 + *) warning "Could not install using native binary packages, falling back to alternative installation method." ;;
2264 esac
2265 ;;
2266 + 3)
2267 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2268 + native) fatal "Native packages are not available for this system, unable to install." F051C ;;
2269 + *) warning "Native packages are not available for this system, falling back to alternative installation method." ;;
2270 + esac
2271 + ;;
2272 + 4)
2273 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2274 + native|auto)
2275 + case "${SELECTED_RELEASE_CHANNEL}" in
2276 + stable) fatal "A stable build with native packages has not yet been published for this system, but is expected to be published within the next few weeks. If you need to install now, you should be able to do so either by using a nightly build (add --release-channel=nightly to the options passed to this script) or by using a static build (add --install-type=static to the options passed to this script). Note that if you use a static build, you may have to reinstall once a stable build is published with native packages for this system to get full support." F051D ;;
2277 + nightly) fatal "A nightly build with native packages has not yet been published for this system, but is expected to be published at 01:00 UTC tomorrow. Please try again tomorrow." F051E ;;
2278 + esac
2279 + ;;
2280 + *) warning "Native packages are not available for this system, falling back to alternative installation method." ;;
2281 + esac
2282 esac
2283 fi
2284
2246 - if [ "${NETDATA_FORCE_METHOD}" != 'native' ] && [ "${NETDATA_FORCE_METHOD}" != 'build' ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
2285 + if [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'native' ] && [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'build' ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
2286 SELECTED_INSTALL_METHOD="static"
2287 INSTALL_TYPE="kickstart-static"
2288 try_static_install
@@ -2255,7 +2294,7 @@ install_on_linux() {
2294 ;;
2295 1) fatal "Unable to install on this system." F0302 ;;
2296 2)
2258 - case "${NETDATA_FORCE_METHOD}" in
2297 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2298 static) fatal "Could not install static build." F0303 ;;
2299 *) warning "Could not install static build, falling back to alternative installation method." ;;
2300 esac
@@ -2263,7 +2302,7 @@ install_on_linux() {
2302 esac
2303 fi
2304
2266 - if [ "${NETDATA_FORCE_METHOD}" != 'native' ] && [ "${NETDATA_FORCE_METHOD}" != 'static' ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
2305 + if [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'native' ] && [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != 'static' ] && [ -z "${NETDATA_INSTALL_SUCCESSFUL}" ]; then
2306 SELECTED_INSTALL_METHOD="build"
2307 INSTALL_TYPE="kickstart-build"
2308 try_build_install
@@ -2276,9 +2315,9 @@ install_on_linux() {
2315 }
2316
2317 install_on_macos() {
2279 - case "${NETDATA_FORCE_METHOD}" in
2280 - native) fatal "User requested native package, but native packages are not available for macOS. Try installing without \`--only-native\` option." F0305 ;;
2281 - static) fatal "User requested static build, but static builds are not available for macOS. Try installing without \`--only-static\` option." F0306 ;;
2318 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2319 + native) fatal "User requested native package, but native packages are not available for macOS. Try installing without \`--native-only\` option." F0305 ;;
2320 + static) fatal "User requested static build, but static builds are not available for macOS. Try installing without \`--static-only\` option." F0306 ;;
2321 *)
2322 SELECTED_INSTALL_METHOD="build"
2323 INSTALL_TYPE="kickstart-build"
@@ -2293,9 +2332,9 @@ install_on_macos() {
2332 }
2333
2334 install_on_freebsd() {
2296 - case "${NETDATA_FORCE_METHOD}" in
2297 - native) fatal "User requested native package, but native packages are not available for FreeBSD. Try installing without \`--only-native\` option." F0308 ;;
2298 - static) fatal "User requested static build, but static builds are not available for FreeBSD. Try installing without \`--only-static\` option." F0309 ;;
2335 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2336 + native) fatal "User requested native package, but native packages are not available for FreeBSD. Try installing without \`--native-only\` option." F0308 ;;
2337 + static) fatal "User requested static build, but static builds are not available for FreeBSD. Try installing without \`--static-only\` option." F0309 ;;
2338 *)
2339 SELECTED_INSTALL_METHOD="build"
2340 INSTALL_TYPE="kickstart-build"
@@ -2349,16 +2388,16 @@ handle_major_version() {
2388 validate_args() {
2389 check_claim_opts
2390
2352 - if [ -n "${NETDATA_FORCE_METHOD}" ]; then
2353 - SELECTED_INSTALL_METHOD="${NETDATA_FORCE_METHOD}"
2391 + if [ -n "${NETDATA_REQUESTED_INSTALL_TYPE}" ]; then
2392 + SELECTED_INSTALL_METHOD="${NETDATA_REQUESTED_INSTALL_TYPE}"
2393 fi
2394
2356 - if [ "${ACTION}" = "repositories-only" ] && [ "${NETDATA_FORCE_METHOD}" != "native" ]; then
2395 + if [ "${ACTION}" = "repositories-only" ] && [ "${NETDATA_REQUESTED_INSTALL_TYPE}" != "native" ]; then
2396 fatal "Repositories can only be installed for native installs." F050D
2397 fi
2398
2399 if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then
2361 - case "${NETDATA_FORCE_METHOD}" in
2400 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2401 native|build) fatal "Offline installs are only supported for static builds currently." F0502 ;;
2402 esac
2403
@@ -2368,14 +2407,14 @@ validate_args() {
2407 fi
2408
2409 if [ -n "${LOCAL_BUILD_OPTIONS}" ]; then
2371 - case "${NETDATA_FORCE_METHOD}" in
2410 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2411 build) NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${LOCAL_BUILD_OPTIONS}" ;;
2412 *) fatal "Specifying local build options is only supported when the --build-only option is also specified." F0401 ;;
2413 esac
2414 fi
2415
2416 if [ -n "${STATIC_INSTALL_OPTIONS}" ]; then
2378 - case "${NETDATA_FORCE_METHOD}" in
2417 + case "${NETDATA_REQUESTED_INSTALL_TYPE}" in
2418 static) NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${STATIC_INSTALL_OPTIONS}" ;;
2419 *) fatal "Specifying installer options options is only supported when the --static-only option is also specified." F0402 ;;
2420 esac
@@ -2527,11 +2566,18 @@ parse_args() {
2566 ;;
2567 "--repositories-only")
2568 set_action 'repositories-only'
2530 - NETDATA_FORCE_METHOD="native"
2569 + NETDATA_REQUESTED_INSTALL_TYPE="native"
2570 + ;;
2571 + "--native-only") NETDATA_REQUESTED_INSTALL_TYPE="native" ;;
2572 + "--static-only") NETDATA_REQUESTED_INSTALL_TYPE="static" ;;
2573 + "--build-only") NETDATA_REQUESTED_INSTALL_TYPE="build" ;;
2574 + "--install-type")
2575 + case "${2}" in
2576 + native|static|build|auto|any) NETDATA_REQUESTED_INSTALL_TYPE="${2}" ;;
2577 + *) fatal "${2} is not a recognized install type. Please specify one of native, static, build, auto, or any." F051F ;;
2578 + esac
2579 + shift 1
2580 ;;
2532 - "--native-only") NETDATA_FORCE_METHOD="native" ;;
2533 - "--static-only") NETDATA_FORCE_METHOD="static" ;;
2534 - "--build-only") NETDATA_FORCE_METHOD="build" ;;
2581 "--claim-"*)
2582 optname="$(echo "${1}" | cut -d '-' -f 4-)"
2583 case "${optname}" in