@cryptotaxi247 / netdata-1 / commits / 4b1691510

fix(updater): fix updating when using `--force-update` and new version of the updater script is available (#13104)

Ilya Mashchenko committed Jun 27, 2022 at 10:58 UTC 4b1691510904fbab21ab7c7cc7e27ffd1557a31c
1 file changed +8 -2
packaging/installer/netdata-updater.sh
+8 -2
@@ -420,7 +420,9 @@ self_update() {
420 if _safe_download "https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/netdata-updater.sh" ./netdata-updater.sh; then
421 chmod +x ./netdata-updater.sh || exit 1
422 export ENVIRONMENT_FILE="${ENVIRONMENT_FILE}"
423 - exec ./netdata-updater.sh --not-running-from-cron --no-updater-self-update --tmpdir-path "$(pwd)"
423 + force_update=""
424 + [ "$NETDATA_FORCE_UPDATE" = "1" ] && force_update="--force-update"
425 + exec ./netdata-updater.sh --not-running-from-cron --no-updater-self-update "$force_update" --tmpdir-path "$(pwd)"
426 else
427 error "Failed to download newest version of updater script, continuing with current version."
428 fi
@@ -551,7 +553,11 @@ update_build() {
553 NEW_CHECKSUM="$(safe_sha256sum netdata-latest.tar.gz 2> /dev/null | cut -d' ' -f1)"
554 tar -xf netdata-latest.tar.gz >&3 2>&3
555 rm netdata-latest.tar.gz >&3 2>&3
554 - cd "$(find . -maxdepth 1 -name "netdata-${path_version}*" | head -n 1)" || fatal "Failed to switch to build directory" U0017
556 + if [ -z "$path_version" ]; then
557 + latest_tag="$(get_latest_version)"
558 + path_version="$(echo "${latest_tag}" | cut -f 1 -d "-")"
559 + fi
560 + cd "$(find . -maxdepth 1 -type d -name "netdata-${path_version}*" | head -n 1)" || fatal "Failed to switch to build directory" U0017
561 RUN_INSTALLER=1
562 fi
563 fi