Fixes conditional for NetData Updater when checking for new updates (#8028)
* Fix proposal for #8027 This commit changes the check for updated releases when running in manual mode * Default (current|latest)_version to 0 and invert the logic Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Gabor Meszaros committed
Feb 12, 2020 at 00:59 UTC
acaae73deaa1db73d904e062eaf443d66f02b8ed
1 file changed
+7
-1
packaging/installer/netdata-updater.sh
+7
-1
@@ -141,10 +141,16 @@ update() {
141
current_version="$(command -v netdata > /dev/null && parse_version "$(netdata -v | cut -f 2 -d ' ')")"
142
latest_version="$(get_latest_version "${tmpdir}/sha256sum.txt")"
143
144
+ # If we can't get the current version for some reason assume `0`
145
+ current_version="${current_version:-0}"
146
+
147
+ # If we can't get the latest version for some reason assume `0`
148
+ latest_version="${latest_version:-0}"
149
+
150
info "Current Version: ${current_version}"
151
info "Latest Version: ${latest_version}"
152
147
- if [ "${latest_version}" -gt 0 ] && [ "${current_version}" -gt 0 ] && [ "${current_version}" -ge "${current_version}" ]; then
153
+ if [ "${latest_version}" -gt 0 ] && [ "${current_version}" -gt 0 ] && [ "${current_version}" -ge "${latest_version}" ]; then
154
info "Newest version ${current_version} <= ${latest_version} is already installed"
155
elif [ -n "${NETDATA_TARBALL_CHECKSUM}" ] && grep "${NETDATA_TARBALL_CHECKSUM}" sha256sum.txt >&3 2>&3; then
156
info "Newest version is already installed"