From c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 14:19:22 +0100 Subject: Adding upstream version 1.44.3. Signed-off-by: Daniel Baumann --- packaging/installer/kickstart.sh | 128 ++++++++++++++++++++++++++++----------- 1 file changed, 94 insertions(+), 34 deletions(-) (limited to 'packaging/installer/kickstart.sh') diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 0ddd750be..f7c078274 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later # -# Next unused error code: F0515 +# Next unused error code: F0516 # ====================================================================== # Constants @@ -38,6 +38,7 @@ FORUM_URL="https://community.netdata.cloud/" INSTALL_DOC_URL="https://learn.netdata.cloud/docs/install-the-netdata-agent/one-line-installer-for-all-linux-systems" PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" PUBLIC_CLOUD_URL="https://app.netdata.cloud" +RELEASE_INFO_URL="https://repo.netdata.cloud/releases" REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" TELEMETRY_URL="https://us-east1-netdata-analytics-bi.cloudfunctions.net/ingest_agent_events" @@ -614,6 +615,22 @@ download() { fi } +get_actual_version() { + major="${1}" + channel="${2}" + url="${RELEASE_INFO_URL}/${channel}/${major}" + + if check_for_remote_file "${RELEASE_INFO_URL}"; then + if check_for_remote_file "${url}"; then + download "${url}" - + else + echo "NONE" + fi + else + echo "" + fi +} + get_redirect() { url="${1}" @@ -1321,24 +1338,20 @@ netdata_avail_check() { # Check for any distro-specific dependencies we know we need. check_special_native_deps() { - if [ "${DISTRO_COMPAT_NAME}" = "centos" ] && [ "${SYSVERSION}" = "7" ]; then - progress "Checking for libuv availability." - if ${pm_cmd} search --nogpgcheck -v libuv | grep -q "No matches found"; then - progress "libuv not found, checking for EPEL availability." - if ${pm_cmd} search --nogpgcheck -v epel-release | grep -q "No matches found"; then - warning "Unable to find a suitable source for libuv, cannot install using native packages on this system." - return 1 - else - progress "EPEL is available, attempting to install so that required dependencies are available." + if [ "${DISTRO_COMPAT_NAME}" = "centos" ] && [ "${SYSVERSION}" -gt 6 ]; then + progress "EPEL is required on this system, checking if it’s available." - # shellcheck disable=SC2086 - if ! run_as_root env ${env} ${pm_cmd} ${install_subcmd} ${pkg_install_opts} epel-release; then - warning "Failed to install EPEL, even though it is required to install native packages on this system." - return 1 - fi - fi + if ${pm_cmd} search --nogpgcheck -v epel-release | grep -q "No matches found"; then + warning "Unable to find a suitable source for libuv, cannot install using native packages on this system." + return 1 else - return 0 + progress "EPEL is available, attempting to install so that required dependencies are available." + + # shellcheck disable=SC2086 + if ! run_as_root env ${env} ${pm_cmd} ${install_subcmd} ${pkg_install_opts} epel-release; then + warning "Failed to install EPEL, even though it is required to install native packages on this system." + return 1 + fi fi fi } @@ -2025,6 +2038,40 @@ install_on_freebsd() { # ====================================================================== # Argument parsing code +handle_major_version() { + CONTINUE_INSTALL_PROMPT="Attempting to install will use the latest version available overall. Do you wish to continue the install?" + + if [ -z "${INSTALL_MAJOR_VERSION}" ]; then + return + fi + + actual_version="$(get_actual_version "v${INSTALL_MAJOR_VERSION}" "${RELEASE_CHANNEL}")" + + if [ -z "${actual_version}" ]; then + if [ "${INTERACTIVE}" -eq 0 ]; then + fatal "Could not determine the lastest releaase in channel '${RELEASE_CHANNEL}' with major version '${INSTALL_MAJOR_VERSION}'" F0517 + else + if confirm "Unable to determine the correct version to install for major version '${INSTALL_MAJOR_VERSION}'. ${CONTINUE_INSTALL_PROMPT}"; then + progress "User requested continuing the install with the latest version." + else + fatal "Cancelling installation at user request." F0518 + fi + fi + elif [ "${actual_version}" = 'NONE' ]; then + if [ "${INTERACTIVE}" -eq 0 ]; then + warning "No releases with major version '${INSTALL_MAJOR_VERSION}' have been published. Continuing the install with the latest version instead." + else + if confirm "No releases with major version '${INSTALL_MAJOR_VERSION}' have been published. ${CONTINUE_INSTALL_PROMPT}"; then + progress "User requested continuing the install with the latest version." + else + fatal "Cancelling installation at user request." F0519 + fi + fi + else + INSTALL_VERSION="${actual_version}" + fi +} + validate_args() { check_claim_opts @@ -2056,22 +2103,6 @@ validate_args() { esac fi - if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ] && [ -n "${INSTALL_VERSION}" ]; then - fatal "Specifying an install version alongside an offline install source is not supported." F050A - fi - - if [ "${NETDATA_AUTO_UPDATES}" = "default" ]; then - if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ] || [ -n "${INSTALL_VERSION}" ]; then - AUTO_UPDATE=0 - else - AUTO_UPDATE=1 - fi - elif [ "${NETDATA_AUTO_UPDATES}" = 1 ]; then - AUTO_UPDATE=1 - else - AUTO_UPDATE=0 - fi - if [ "${RELEASE_CHANNEL}" = "default" ]; then if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then SELECTED_RELEASE_CHANNEL="$(cat "${NETDATA_OFFLINE_INSTALL_SOURCE}/channel")" @@ -2089,6 +2120,31 @@ validate_args() { SELECTED_RELEASE_CHANNEL="${RELEASE_CHANNEL}" fi + + if [ -n "${INSTALL_MAJOR_VERSION}" ] && [ -n "${INSTALL_VERSION}" ]; then + fatal "Only one of --install-version or --install-major-version may be specified." F0515 + fi + + handle_major_version # Appropriately updates INSTALL_VERSION if INSTALL_MAJOR_VERSION is set. + + if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ] && [ -n "${INSTALL_VERSION}" ]; then + fatal "Specifying an install version alongside an offline install source is not supported." F050A + fi + + if [ "${NETDATA_AUTO_UPDATES}" = "default" ]; then + if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ] || [ -n "${INSTALL_VERSION}" ]; then + AUTO_UPDATE=0 + else + AUTO_UPDATE=1 + fi + elif [ "${NETDATA_INSTALL_MAJOR_VERSION}" ]; then + warning "Forcibly disabling auto updates as a specific major version was requested." + AUTO_UPDATE=0 + elif [ "${NETDATA_AUTO_UPDATES}" = 1 ]; then + AUTO_UPDATE=1 + else + AUTO_UPDATE=0 + fi } set_action() { @@ -2134,7 +2190,7 @@ parse_args() { "--claim-only") set_action 'claim' ;; "--no-updates") NETDATA_AUTO_UPDATES=0 ;; "--auto-update") NETDATA_AUTO_UPDATES="1" ;; - "--auto-update-method") + "--auto-update-type"|"--auto-update-method") NETDATA_AUTO_UPDATE_TYPE="$(echo "${2}" | tr '[:upper:]' '[:lower:]')" case "${NETDATA_AUTO_UPDATE_TYPE}" in systemd|interval|crontab) shift 1 ;; @@ -2168,6 +2224,10 @@ parse_args() { OLD_INSTALL_PREFIX="${2}" shift 1 ;; + "--install-major-version") + INSTALL_MAJOR_VERSION="${2}" + shift 1 + ;; "--install-version") INSTALL_VERSION="${2}" AUTO_UPDATE=0 -- cgit v1.2.3