diff options
Diffstat (limited to 'packaging/installer/kickstart.sh')
-rwxr-xr-x | packaging/installer/kickstart.sh | 79 |
1 files changed, 61 insertions, 18 deletions
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index f7c078274..6d9f4ea0e 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: F0516 +# Next unused error code: F0517 # ====================================================================== # Constants @@ -21,10 +21,10 @@ KICKSTART_SOURCE="$( )" DEFAULT_PLUGIN_PACKAGES="" PATH="${PATH}:/usr/local/bin:/usr/local/sbin" -REPOCONFIG_DEB_VERSION="2-1" -REPOCONFIG_RPM_VERSION="2-1" +REPOCONFIG_DEB_VERSION="2-2" +REPOCONFIG_RPM_VERSION="2-2" START_TIME="$(date +%s)" -STATIC_INSTALL_ARCHES="x86_64 armv7l aarch64 ppc64le" +STATIC_INSTALL_ARCHES="x86_64 armv7l armv6l aarch64 ppc64le" # ====================================================================== # URLs used throughout the script @@ -125,6 +125,7 @@ main() { ;; esac + handle_existing_install set_tmpdir if [ -n "${INSTALL_VERSION}" ]; then @@ -402,6 +403,9 @@ support_list() { } success_banner() { + printf >&2 "%s\n" "To view your system's real-time performance metrics, open your web browser and enter http://NODE:19999." + printf >&2 "%s\n\n" "Replace NODE with the IP address or hostname of your Netdata server to access the dashboard." + printf >&2 "%s\n\n" "Official documentation can be found online at ${DOCS_URL}." if [ -z "${CLAIM_TOKEN}" ]; then @@ -591,6 +595,8 @@ check_for_remote_file() { if echo "${url}" | grep -Eq "^file:///"; then [ -e "${url#file://}" ] || return 1 + elif [ -n "${NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT}" ]; then + return 0 elif [ -n "${CURL}" ]; then "${CURL}" --output /dev/null --silent --head --fail "${url}" || return 1 elif command -v wget > /dev/null 2>&1; then @@ -635,9 +641,9 @@ get_redirect() { url="${1}" if [ -n "${CURL}" ]; then - run sh -c "${CURL} ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1 + run sh -c "${CURL} ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -Eo '[^/]+$'" || return 1 elif command -v wget > /dev/null 2>&1; then - run sh -c "wget -S -O /dev/null ${url} 2>&1 | grep -m 1 Location | grep -o '[^/]*$'" || return 1 + run sh -c "wget -S -O /dev/null ${url} 2>&1 | grep -m 1 Location | grep -Eo '[^/]+$'" || return 1 else fatal "${ERROR_F0003}" F0003 fi @@ -1325,7 +1331,7 @@ netdata_avail_check() { ;; centos|fedora|ol|amzn) # shellcheck disable=SC2086 - ${pm_cmd} search --nogpgcheck -v netdata | grep -qE 'Repo *: netdata(-edge)?$' + LC_ALL=C ${pm_cmd} search --nogpgcheck -v netdata | grep -qE 'Repo *: netdata(-edge)?$' return $? ;; opensuse) @@ -1341,7 +1347,7 @@ check_special_native_deps() { if [ "${DISTRO_COMPAT_NAME}" = "centos" ] && [ "${SYSVERSION}" -gt 6 ]; then progress "EPEL is required on this system, checking if it’s available." - if ${pm_cmd} search --nogpgcheck -v epel-release | grep -q "No matches found"; then + if LC_ALL=C ${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 @@ -1356,6 +1362,14 @@ check_special_native_deps() { fi } +cleanup_apt_cache() { + cache_dir="/var/cache/apt/archives" + + if [ -d "${cache_dir}" ]; then + run_as_root find "${cache_dir}" -type f -name 'netdata*.deb' -delete + fi +} + common_rpm_opts() { pkg_type="rpm" pkg_suffix=".noarch" @@ -1422,6 +1436,7 @@ try_package_install() { install_subcmd="install" fi needs_early_refresh=1 + needs_apt_cache_cleanup=1 pm_cmd="apt-get" repo_subcmd="update" pkg_type="deb" @@ -1496,15 +1511,21 @@ try_package_install() { deb) repoconfig_file="${repoconfig_name}${pkg_vsep}${REPOCONFIG_DEB_VERSION}${pkg_suffix}.${pkg_type}" repoconfig_url="${REPOCONFIG_DEB_URL_PREFIX}/${repo_prefix}/${repoconfig_file}" + ref_check_url="${REPOCONFIG_DEB_URL_PREFIX}" ;; 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}" + ref_check_url="${REPOCONFIG_RPM_URL_PREFIX}" ;; esac if ! pkg_installed "${repoconfig_name}"; then progress "Checking for availability of repository configuration package." + if ! check_for_remote_file "${ref_check_url}"; then + NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1 + fi + if ! check_for_remote_file "${repoconfig_url}"; then warning "No repository configuration package available for ${DISTRO} ${SYSVERSION}. Cannot install native packages on this system." return 2 @@ -1520,6 +1541,10 @@ try_package_install() { warning "${failed_refresh_msg}" return 2 fi + + if [ -n "${needs_apt_cache_cleanup}" ]; then + cleanup_apt_cache + fi fi # shellcheck disable=SC2086 @@ -1643,6 +1668,10 @@ try_static_install() { progress "Attempting to install using static build..." fi + if ! check_for_remote_file "${NETDATA_TARBALL_BASEURL}"; then + NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1 + fi + # Check status code first, so that we can provide nicer fallback for dry runs. if check_for_remote_file "${NETDATA_STATIC_ARCHIVE_URL}"; then netdata_agent="${NETDATA_STATIC_ARCHIVE_NAME}" @@ -1650,7 +1679,7 @@ try_static_install() { 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." + warning "Could not find a ${SELECTED_RELEASE_CHANNEL} static build for ${SYSARCH} CPUs. This usually means there is some networking issue preventing access to https://github.com/ from this system." return 2 fi @@ -1750,8 +1779,14 @@ install_local_build_dependencies() { fi # shellcheck disable=SC2086 - if ! run_as_root "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then - warning "Failed to install all required packages, but installation might still be possible." + if [ "$(uname -s)" = "Darwin" ]; then + if ! run "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then + warning "Failed to install all required packages, but installation might still be possible." + fi + else + if ! run_as_root "${bash}" "${tmpdir}/install-required-packages.sh" ${opts} netdata; then + warning "Failed to install all required packages, but installation might still be possible." + fi fi } @@ -1875,13 +1910,21 @@ prepare_offline_install_source() { static|'') set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "x86_64" + if ! check_for_remote_file "${NETDATA_TARBALL_BASEURL}"; then + NETDATA_ASSUME_REMOTE_FILES_ARE_PRESENT=1 + fi + if check_for_remote_file "${NETDATA_STATIC_ARCHIVE_URL}"; then for arch in ${STATIC_INSTALL_ARCHES}; do set_static_archive_urls "${SELECTED_RELEASE_CHANNEL}" "${arch}" - progress "Fetching ${NETDATA_STATIC_ARCHIVE_URL}" - if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "netdata-${arch}-latest.gz.run"; then - warning "Failed to download static installer archive for ${arch}. ${BADNET_MSG}." + if check_for_remote_file "${NETDATA_STATIC_ARCH_URL}"; then + progress "Fetching ${NETDATA_STATIC_ARCHIVE_URL}" + if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "netdata-${arch}-latest.gz.run"; then + warning "Failed to download static installer archive for ${arch}. ${BADNET_MSG}." + fi + else + progress "Skipping ${NETDATA_STATIC_ARCHIVE_URL} as it does not exist on the server." fi done legacy=0 @@ -1895,6 +1938,10 @@ prepare_offline_install_source() { fi fi + if ! find . -name '*.gz.run'; then + fatal "Did not actually download any static installer archives, cannot continue. ${BADNET_MSG}." F0516 + fi + progress "Fetching ${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "sha256sums.txt"; then fatal "Failed to download checksum file. ${BADNET_MSG}." F0506 @@ -2325,8 +2372,4 @@ confirm_root_support get_system_info confirm_install_prefix -if [ -z "${ACTION}" ]; then - handle_existing_install -fi - main |