diff options
Diffstat (limited to 'packaging/installer/kickstart.sh')
-rwxr-xr-x | packaging/installer/kickstart.sh | 126 |
1 files changed, 65 insertions, 61 deletions
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 295fcdca0..30c7b4cab 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: F050D +# Next unused error code: F050F # ====================================================================== # Constants @@ -28,8 +28,10 @@ KICKSTART_SOURCE="$( PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" PATH="${PATH}:/usr/local/bin:/usr/local/sbin" PUBLIC_CLOUD_URL="https://app.netdata.cloud" -REPOCONFIG_URL_PREFIX="https://packagecloud.io/netdata/netdata-repoconfig/packages" -REPOCONFIG_VERSION="1-2" +REPOCONFIG_DEB_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" +REPOCONFIG_DEB_VERSION="2-1" +REPOCONFIG_RPM_URL_PREFIX="https://repo.netdata.cloud/repos/repoconfig" +REPOCONFIG_RPM_VERSION="2-1" START_TIME="$(date +%s)" STATIC_INSTALL_ARCHES="x86_64 armv7l aarch64 ppc64le" TELEMETRY_URL="https://posthog.netdata.cloud/capture/" @@ -43,9 +45,10 @@ INSTALL_TYPE="unknown" INSTALL_PREFIX="" NETDATA_AUTO_UPDATES="default" NETDATA_CLAIM_ONLY=0 -NETDATA_CLAIM_URL="api.netdata.cloud" +NETDATA_CLAIM_URL="https://api.netdata.cloud" NETDATA_COMMAND="default" NETDATA_DISABLE_CLOUD=0 +NETDATA_INSTALLER_OPTIONS="" NETDATA_ONLY_BUILD=0 NETDATA_ONLY_NATIVE=0 NETDATA_ONLY_STATIC=0 @@ -62,8 +65,7 @@ else NETDATA_DISABLE_TELEMETRY=0 fi -NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://storage.googleapis.com/netdata-nightlies}" -NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:-""}" +NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://github.com/netdata/netdata-nightlies/releases}" TELEMETRY_API_KEY="${NETDATA_POSTHOG_API_KEY:-mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y}" if echo "${0}" | grep -q 'kickstart-static64'; then @@ -181,7 +183,6 @@ USAGE: kickstart.sh [options] --reinstall-even-if-unsafe Even try to reinstall if we don't think we can do so safely (implies --reinstall). --disable-cloud Disable support for Netdata Cloud (default: detect) --require-cloud Only install if Netdata Cloud can be enabled. Overrides --disable-cloud. - --install <path> This option is deprecated and will be removed in a future version, use --install-prefix instead. --install-prefix <path> Specify an installation prefix for local builds (default: autodetect based on system type). --old-install-prefix <path> Specify an old local builds installation prefix for uninstall/reinstall (if it's not default). --install-version <version> Specify the version of Netdata to install. @@ -301,12 +302,21 @@ EOF if command -v curl > /dev/null 2>&1; then curl --silent -o /dev/null -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}" > /dev/null elif command -v wget > /dev/null 2>&1; then - wget -q -O - --no-check-certificate \ - --method POST \ - --timeout=1 \ - --header 'Content-Type: application/json' \ - --body-data "${REQ_BODY}" \ - "${TELEMETRY_URL}" > /dev/null + if wget --help 2>&1 | grep BusyBox > /dev/null 2>&1; then + # BusyBox-compatible version of wget, there is no --no-check-certificate option + wget -q -O - \ + -T 1 \ + --header 'Content-Type: application/json' \ + --post-data "${REQ_BODY}" \ + "${TELEMETRY_URL}" > /dev/null + else + wget -q -O - --no-check-certificate \ + --method POST \ + --timeout=1 \ + --header 'Content-Type: application/json' \ + --body-data "${REQ_BODY}" \ + "${TELEMETRY_URL}" > /dev/null + fi fi } @@ -591,7 +601,7 @@ get_redirect() { if command -v curl > /dev/null 2>&1; then run sh -c "curl ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1 elif command -v wget > /dev/null 2>&1; then - run sh -c "wget --max-redirect=0 ${url} 2>&1 | grep Location | cut -d ' ' -f2 | grep -o '[^/]*$'" || return 1 + run sh -c "wget -S -O /dev/null ${url} 2>&1 | grep -m 1 Location | grep -o '[^/]*$'" || return 1 else fatal "${ERROR_F0003}" F0003 fi @@ -1044,7 +1054,7 @@ EOF confirm_install_prefix() { if [ -n "${INSTALL_PREFIX}" ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then - fatal "The --install-prefix and --install options are only supported together with the --build-only option." F0204 + fatal "The --install-prefix option is only supported together with the --build-only option." F0204 fi if [ -n "${INSTALL_PREFIX}" ]; then @@ -1282,7 +1292,7 @@ pkg_installed() { netdata_avail_check() { case "${DISTRO_COMPAT_NAME}" in debian|ubuntu) - env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q packagecloud.io/netdata/netdata; + env DEBIAN_FRONTEND=noninteractive apt-cache policy netdata | grep -q repo.netdata.cloud/repos/; return $? ;; centos|fedora|ol) @@ -1361,7 +1371,7 @@ try_package_install() { repo_subcmd="update" repo_prefix="debian/${SYSCODENAME}" pkg_type="deb" - pkg_suffix="_all" + pkg_suffix="+debian${SYSVERSION}_all" pkg_vsep="_" pkg_install_opts="${interactive_opts}" repo_update_opts="${interactive_opts}" @@ -1375,7 +1385,7 @@ try_package_install() { repo_subcmd="update" repo_prefix="ubuntu/${SYSCODENAME}" pkg_type="deb" - pkg_suffix="_all" + pkg_suffix="+ubuntu${SYSVERSION}_all" pkg_vsep="_" pkg_install_opts="${interactive_opts}" repo_update_opts="${interactive_opts}" @@ -1468,8 +1478,17 @@ try_package_install() { fi repoconfig_name="netdata-repo${release}" - repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_VERSION}${pkg_suffix}.${pkg_type}" - repoconfig_url="${REPOCONFIG_URL_PREFIX}/${repo_prefix}/${repoconfig_file}/download.${pkg_type}" + + case "${pkg_type}" in + deb) + repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_DEB_VERSION}${pkg_suffix}.${pkg_type}" + repoconfig_url="${REPOCONFIG_DEB_URL_PREFIX}/${repo_prefix}/${repoconfig_file}" + ;; + rpm) + repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_RPM_VERSION}${pkg_suffix}.${pkg_type}" + repoconfig_url="${REPOCONFIG_RPM_URL_PREFIX}/${repo_prefix}/${SYSARCH}/${repoconfig_file}" + ;; + esac if ! pkg_installed "${repoconfig_name}"; then progress "Checking for availability of repository configuration package." @@ -1507,7 +1526,7 @@ try_package_install() { fi if [ "${REPO_ACTION}" = "repositories-only" ]; then - progress "Successfully installed repository configuraion package." + progress "Successfully installed repository configuration package." deferred_warnings cleanup trap - EXIT @@ -1564,25 +1583,33 @@ set_static_archive_urls() { if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then path="$(cd "${NETDATA_OFFLINE_INSTALL_SOURCE}" || exit 1; pwd)" export NETDATA_STATIC_ARCHIVE_URL="file://${path}/netdata-${arch}-latest.gz.run" + export NETDATA_STATIC_ARCHIVE_NAME="netdata-${arch}-latest.gz.run" export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="file://${path}/sha256sums.txt" elif [ "${1}" = "stable" ]; then if [ -n "${INSTALL_VERSION}" ]; then - export NETDATA_STATIC_ARCHIVE_OLD_URL="https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/netdata-v${INSTALL_VERSION}.gz.run" export NETDATA_STATIC_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/netdata-${arch}-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_OLD_URL="https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/netdata-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_NAME="netdata-${arch}-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_OLD_NAME="netdata-v${INSTALL_VERSION}.gz.run" export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/sha256sums.txt" else latest="$(get_redirect "https://github.com/netdata/netdata/releases/latest")" export NETDATA_STATIC_ARCHIVE_URL="https://github.com/netdata/netdata/releases/download/${latest}/netdata-${arch}-latest.gz.run" + export NETDATA_STATIC_ARCHIVE_NAME="netdata-${arch}-latest.gz.run" export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/${latest}/sha256sums.txt" fi else if [ -n "${INSTALL_VERSION}" ]; then - export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-${arch}-v${INSTALL_VERSION}.gz.run" - export NETDATA_STATIC_ARCHIVE_OLD_URL="${NETDATA_TARBALL_BASEURL}/netdata-v${INSTALL_VERSION}.gz.run" - export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt" + export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/download/v${INSTALL_VERSION}/netdata-${arch}-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_OLD_URL="${NETDATA_TARBALL_BASEURL}/download/v${INSTALL_VERSION}/netdata-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_NAME="netdata-${arch}-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_OLD_NAME="netdata-v${INSTALL_VERSION}.gz.run" + export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/download/v${INSTALL_VERSION}/sha256sums.txt" else - export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-${arch}-latest.gz.run" - export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt" + tag="$(get_redirect "${NETDATA_TARBALL_BASEURL}/latest")" + export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/download/${tag}/netdata-${arch}-latest.gz.run" + export NETDATA_STATIC_ARCHIVE_NAME="netdata-${arch}-latest.gz.run" + export NETDATA_STATIC_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/download/${tag}/sha256sums.txt" fi fi } @@ -1597,23 +1624,9 @@ try_static_install() { # Check status code first, so that we can provide nicer fallback for dry runs. if check_for_remote_file "${NETDATA_STATIC_ARCHIVE_URL}"; then - if [ -n "${NETDATA_OFFLINE_INSTALL_SOURCE}" ]; then - netdata_agent="$(basename "${NETDATA_STATIC_ARCHIVE_URL#"file://"}")" - elif [ -n "${INSTALL_VERSION}" ]; then - if [ "${SELECTED_RELEASE_CHANNEL}" = "stable" ]; then - netdata_agent="${NETDATA_STATIC_ARCHIVE_URL#"https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/"}" - else - netdata_agent="${NETDATA_STATIC_ARCHIVE_URL#"${NETDATA_TARBALL_BASEURL}/"}" - fi - else - if [ "${SELECTED_RELEASE_CHANNEL}" = "stable" ]; then - netdata_agent="${NETDATA_STATIC_ARCHIVE_URL#"https://github.com/netdata/netdata/releases/download/${latest}/"}" - else - netdata_agent="${NETDATA_STATIC_ARCHIVE_URL#"${NETDATA_TARBALL_BASEURL}/"}" - fi - fi + netdata_agent="${NETDATA_STATIC_ARCHIVE_NAME}" elif [ "${SYSARCH}" = "x86_64" ] && check_for_remote_file "${NETDATA_STATIC_ARCHIVE_OLD_URL}"; then - netdata_agent="${NETDATA_STATIC_ARCHIVE_OLD_URL#"https://github.com/netdata/netdata/releases/download/v${INSTALL_VERSION}/"}" + netdata_agent="${NETDATA_STATIC_ARCHIVE_OLD_NAME}" export NETDATA_STATIC_ARCHIVE_URL="${NETDATA_STATIC_ARCHIVE_OLD_URL}" else warning "There is no static build available for ${SYSARCH} CPUs. This usually means we simply do not currently provide static builds for ${SYSARCH} CPUs." @@ -1682,11 +1695,12 @@ set_source_archive_urls() { fi else if [ -n "${INSTALL_VERSION}" ]; then - export NETDATA_SOURCE_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-v${INSTALL_VERSION}.tar.gz" - export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt" + export NETDATA_SOURCE_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/download/v${INSTALL_VERSION}/netdata-latest.tar.gz" + export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/download/v${INSTALL_VERSION}/sha256sums.txt" else - export NETDATA_SOURCE_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/netdata-latest.tar.gz" - export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/sha256sums.txt" + tag="$(get_redirect "${NETDATA_TARBALL_BASEURL}/latest")" + export NETDATA_SOURCE_ARCHIVE_URL="${NETDATA_TARBALL_BASEURL}/download/${tag}/netdata-latest.tar.gz" + export NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL="${NETDATA_TARBALL_BASEURL}/download/${tag}/sha256sums.txt" fi fi } @@ -1842,7 +1856,7 @@ prepare_offline_install_source() { run mkdir -p "${1}" || fatal "Unable to create target directory for offline install preparation." F0504 fi - run cd "${1}" || fatal "Failed to swtich to target directory for offline install preparation." F0505 + run cd "${1}" || fatal "Failed to switch to target directory for offline install preparation." F0505 if [ "${NETDATA_ONLY_NATIVE}" -ne 1 ] && [ "${NETDATA_ONLY_BUILD}" -ne 1 ]; then set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "x86_64" @@ -2088,10 +2102,6 @@ validate_args() { } parse_args() { - if [ -n "${NETDATA_INSTALLER_OPTIONS}" ]; then - warning "Explicitly specifying additional installer options with NETDATA_INSTALLER_OPTIONS is deprecated. Please instead pass the options to the script using either --local-build-options or --static-install-options as appropriate." - fi - while [ -n "${1}" ]; do case "${1}" in "--help") @@ -2147,11 +2157,6 @@ parse_args() { NETDATA_DISABLE_TELEMETRY="1" NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} --disable-telemetry" ;; - "--install") - warning "--install flag is deprecated and will be removed in a future version. Please use --install-prefix instead." - INSTALL_PREFIX="${2}" - shift 1 - ;; "--install-prefix") INSTALL_PREFIX="${2}" shift 1 @@ -2223,11 +2228,11 @@ parse_args() { esac ;; "--local-build-options") - LOCAL_BUILD_OPTIONS="${2}" + LOCAL_BUILD_OPTIONS="${LOCAL_BUILD_OPTIONS} ${2}" shift 1 ;; "--static-install-options") - STATIC_INSTALL_OPTIONS="${2}" + STATIC_INSTALL_OPTIONS="${STATIC_INSTALL_OPTIONS} ${2}" shift 1 ;; "--prepare-offline-install-source") @@ -2249,8 +2254,7 @@ parse_args() { fi ;; *) - warning "Passing unrecognized option '${1}' to installer script. This behavior is deprecated and will be removed in the near future. If you intended to pass this option to the installer code, please use either --local-build-options or --static-install-options to specify it instead." - NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS} ${1}" + fatal "Unrecognized option '${1}'. If you intended to pass this option to the installer code, please use either --local-build-options or --static-install-options to specify it instead." F050E ;; esac shift 1 |