diff options
author | James Mills <prologic@shortcircuit.net.au> | 2020-06-03 00:46:29 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 00:46:29 +1000 |
commit | 57c916530c7ce9b7ca7905bfc06d676d34dd2f76 (patch) | |
tree | 2a6ed8aa7f22988028b46c531442ca4fadd7c9ae /packaging/installer/netdata-updater.sh | |
parent | dc3f425a7d2992a8ea3df2c15622e032a37bf512 (diff) |
Fix reliability of kickstart/kickstart-static64 with checksums sometimes failing (#9165)
* Add tool to build the dist and static x864_64 artifacts
* Add support for overriding the URL for installing/updating from nightlies
* Refactor curl/wget usage into less places. Use curl -q and --output and -O options instead of redirecting stdout
* Update md5sum(s) of kickstart/kickstart-static64
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rwxr-xr-x | packaging/installer/netdata-updater.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 781575c711..922d63eaa6 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -14,6 +14,10 @@ # - NETDATA_TARBALL_CHECKSUM # - NETDATA_PREFIX / NETDATA_LIB_DIR (After 1.16.1 we will only depend on lib dir) # +# Optional environment options: +# +# - NETDATA_TARBALL_BASEURL (set the base url for downloading the dist tarball) +# # Copyright: SPDX-License-Identifier: GPL-3.0-or-later # # Author: Paweł Krupa <paulfantom@gmail.com> @@ -108,7 +112,7 @@ get_latest_version() { if [ "${RELEASE_CHANNEL}" == "stable" ]; then latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)" else - latest="$(download "https://storage.googleapis.com/netdata-nightlies/latest-version.txt" /dev/stdout)" + latest="$(download "$NETDATA_TARBALL_BASEURL/latest-version.txt" /dev/stdout)" fi parse_version "$latest" } @@ -123,13 +127,12 @@ set_tarball_urls() { if [ "$1" = "stable" ]; then local latest # Simple version - # latest="$(curl -sSL https://api.github.com/repos/netdata/netdata/releases/latest | grep tag_name | cut -d'"' -f4)" latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)" export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-$latest.${extension}" export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt" else - export NETDATA_TARBALL_URL="https://storage.googleapis.com/netdata-nightlies/netdata-latest.${extension}" - export NETDATA_TARBALL_CHECKSUM_URL="https://storage.googleapis.com/netdata-nightlies/sha256sums.txt" + export NETDATA_TARBALL_URL="$NETDATA_TARBALL_BASEURL/netdata-latest.${extension}" + export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_TARBALL_BASEURL/sha256sums.txt" fi } @@ -185,8 +188,8 @@ update() { do_not_start="--dont-start-it" fi - if [ -n "${NETDATA_SELECTED_DASHBOARD}" ] ; then - env="NETDATA_SELECTED_DASHBOARD=${NETDATA_SELECTED_DASHBOARD}" + if [ -n "${NETDATA_SELECTED_DASHBOARD}" ]; then + env="NETDATA_SELECTED_DASHBOARD=${NETDATA_SELECTED_DASHBOARD}" fi info "Re-installing netdata..." @@ -222,6 +225,9 @@ export NETDATA_LIB_DIR="${NETDATA_LIB_DIR:-${NETDATA_PREFIX}/var/lib/netdata}" # Source the tarbal 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")" +# Netdata Tarball Base URL (defaults to our Google Storage Bucket) +[ -z "$NETDATA_TARBALL_BASEURL" ] && NETDATA_TARBALL_BASEURL=https://storage.googleapis.com/netdata-nightlies + if [ "${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)" fi |