diff options
Diffstat (limited to 'packaging/installer')
-rwxr-xr-x | packaging/installer/kickstart.sh | 49 | ||||
-rwxr-xr-x | packaging/installer/netdata-updater.sh | 32 |
2 files changed, 41 insertions, 40 deletions
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index bb4c678f08..001567c0ab 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -65,7 +65,7 @@ else NETDATA_DISABLE_TELEMETRY=0 fi -NETDATA_TARBALL_BASEURL="${NETDATA_TARBALL_BASEURL:-https://storage.googleapis.com/netdata-nightlies}" +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 @@ -1574,25 +1574,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 } @@ -1607,23 +1615,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." @@ -1692,11 +1686,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 } diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 8740e7db2a..5e6a786eb3 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -34,6 +34,9 @@ set -e PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh" +NETDATA_STABLE_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata/releases}" +NETDATA_NIGHTLY_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata-nightlies/releases}" + script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" if [ -x "${script_dir}/netdata-updater" ]; then @@ -369,8 +372,8 @@ download() { } get_netdata_latest_tag() { - dest="${1}" - url="https://github.com/netdata/netdata/releases/latest" + url="${1}/latest" + dest="${2}" if command -v curl >/dev/null 2>&1; then tag=$(curl "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -m 1 -o '[^/]*$') @@ -439,7 +442,12 @@ self_update() { parse_version() { r="${1}" - if echo "${r}" | grep -q '^v.*'; then + if [ "${r}" = "latest" ]; then + # If we get ‘latest’ as a version, return the largest possible + # version value. + printf "99999999999999" + return 0 + elif echo "${r}" | grep -q '^v.*'; then # shellcheck disable=SC2001 # XXX: Need a regex group substitution here. r="$(echo "${r}" | sed -e 's/^v\(.*\)/\1/')" @@ -463,9 +471,9 @@ parse_version() { get_latest_version() { if [ "${RELEASE_CHANNEL}" = "stable" ]; then - get_netdata_latest_tag /dev/stdout + get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}" /dev/stdout else - download "$NETDATA_NIGHTLIES_BASEURL/latest-version.txt" /dev/stdout + get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}" /dev/stdout fi } @@ -529,12 +537,13 @@ set_tarball_urls() { fi if [ "$1" = "stable" ]; then - latest="$(get_netdata_latest_tag /dev/stdout)" - export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/${filename}" - export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt" + latest="$(get_netdata_latest_tag "${NETDATA_STABLE_BASE_URL}" /dev/stdout)" + export NETDATA_TARBALL_URL="${NETDATA_STABLE_BASE_URL}/download/$latest/${filename}" + export NETDATA_TARBALL_CHECKSUM_URL="${NETDATA_STABLE_BASE_URL}/download/$latest/sha256sums.txt" else - export NETDATA_TARBALL_URL="$NETDATA_NIGHTLIES_BASEURL/${filename}" - export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_NIGHTLIES_BASEURL/sha256sums.txt" + tag="$(get_netdata_latest_tag "${NETDATA_NIGHTLY_BASE_URL}" /dev/stdout)" + export NETDATA_TARBALL_URL="${NETDATA_NIGHTLY_BASE_URL}/download/${tag}/${filename}" + export NETDATA_TARBALL_CHECKSUM_URL="${NETDATA_NIGHTLY_BASE_URL}/download/${tag}/sha256sums.txt" fi } @@ -907,9 +916,6 @@ export NETDATA_LIB_DIR="${NETDATA_LIB_DIR:-${NETDATA_PREFIX}/var/lib/netdata}" # Source the tarball checksum, if not already available from environment (for existing installations with the old logic) [ -z "${NETDATA_TARBALL_CHECKSUM}" ] && [ -f "${NETDATA_LIB_DIR}/netdata.tarball.checksum" ] && NETDATA_TARBALL_CHECKSUM="$(cat "${NETDATA_LIB_DIR}/netdata.tarball.checksum")" -# Grab the nightlies baseurl (defaulting to our Google Storage bucket) -export NETDATA_NIGHTLIES_BASEURL="${NETDATA_NIGHTLIES_BASEURL:-https://storage.googleapis.com/netdata-nightlies}" - if echo "$INSTALL_TYPE" | grep -qv ^binpkg && [ "${INSTALL_UID}" != "$(id -u)" ]; then fatal "You are running this script as user with uid $(id -u). We recommend to run this script as root (user with uid 0)" U0011 fi |