diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:55 +0000 |
commit | caf1a5281f9e974ba73ceded3a782db3d0142c5f (patch) | |
tree | a09197b1fd2e984a0e8598e7007deb2a8e1969d7 /packaging/installer/netdata-updater.sh | |
parent | Releasing debian version 1.14.0~rc0-1. (diff) | |
download | netdata-caf1a5281f9e974ba73ceded3a782db3d0142c5f.tar.xz netdata-caf1a5281f9e974ba73ceded3a782db3d0142c5f.zip |
Merging upstream version 1.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rw-r--r-- | packaging/installer/netdata-updater.sh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 071198dd..56c83795 100644 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -20,6 +20,18 @@ error() { echo >&3 "$(date) : ERROR: " "${@}" } +safe_sha256sum() { + # Within the contexct of the installer, we only use -c option that is common between the two commands + # We will have to reconsider if we start non-common options + if command -v sha256sum >/dev/null 2>&1; then + sha256sum $@ + elif command -v shasum >/dev/null 2>&1; then + shasum -a 256 $@ + else + fatal "I could not find a suitable checksum binary to use" + fi +} + # this is what we will do if it fails (head-less only) fatal() { error "FAILED TO UPDATE NETDATA : ${1}" @@ -79,10 +91,10 @@ update() { info "Newest version is already installed" else download "${NETDATA_TARBALL_URL}" "${dir}/netdata-latest.tar.gz" - if ! grep netdata-latest.tar.gz sha256sum.txt | sha256sum --check - >&3 2>&3; then - failed "Tarball checksum validation failed. Stopping netdata upgrade and leaving tarball in ${dir}" + if ! grep netdata-latest.tar.gz sha256sum.txt | safe_sha256sum -c - >&3 2>&3; then + fatal "Tarball checksum validation failed. Stopping netdata upgrade and leaving tarball in ${dir}" fi - NEW_CHECKSUM="$(sha256sum netdata-latest.tar.gz 2>/dev/null| cut -d' ' -f1)" + NEW_CHECKSUM="$(safe_sha256sum netdata-latest.tar.gz 2>/dev/null| cut -d' ' -f1)" tar -xf netdata-latest.tar.gz >&3 2>&3 rm netdata-latest.tar.gz >&3 2>&3 cd netdata-* |