summaryrefslogtreecommitdiffstats
path: root/packaging/installer/netdata-updater.sh
diff options
context:
space:
mode:
authorPaul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com>2019-07-27 00:50:34 +0300
committerGitHub <noreply@github.com>2019-07-27 00:50:34 +0300
commite3babcb33931b2a5b99d14d950108e9ffea0a403 (patch)
tree12599c720043c8609d05683fdaf2398dff774e7e /packaging/installer/netdata-updater.sh
parentfa49ebfb3e64fd4c58ffd5a5db0b53054f6c5713 (diff)
netdata/packaging: Adopt netdata-updater to run properly for static64 installations. (#6520)
* netdata/packaging: Start support for netdata-updater compatibility on static installation 1) Make netdata-installer.sh accept --static option, that simply passes variable IS_NETDATA_STATIC_BINARY=yes to the environment 2) Adjust the updater to check that variable and then is set to yes, make it download the static binary and run the static binary In theory, this should give us the required info on the updater. Only thing missing is how to catch the extra arguments the user might have given on the initial install. Will rework this after i test this first draft change * netdata/packaging: dont forget to enter the temp dir and also return to the original one afterwards. Print some info too. * netdata/packaging: reduce complexity on parameters for installer. Rather expect the variable to be set by the caller. this way we wont let the users get confused by the existence of a flag that only has internal usage. * netdata/packaging: dont forget to clean up the whole folder, its a temp
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rwxr-xr-xpackaging/installer/netdata-updater.sh42
1 files changed, 37 insertions, 5 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh
index c532d39939..bb5f371879 100755
--- a/packaging/installer/netdata-updater.sh
+++ b/packaging/installer/netdata-updater.sh
@@ -73,21 +73,26 @@ download() {
}
set_tarball_urls() {
+ local extension="tar.gz"
if [ ! -z "${NETDATA_LOCAL_TARBAL_OVERRIDE}" ]; then
info "Not fetching remote tarballs, local override was given"
return
fi
+ if [ "$2" == "yes" ]; then
+ extension="gz.run"
+ fi
+
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.tar.gz"
+ 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.tar.gz"
+ 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"
fi
}
@@ -171,7 +176,34 @@ else
exec 3>"${logfile}"
fi
-set_tarball_urls "${RELEASE_CHANNEL}"
+set_tarball_urls "${RELEASE_CHANNEL}" "${IS_NETDATA_STATIC_BINARY}"
+
+if [ "${IS_NETDATA_STATIC_BINARY}" == "yes" ]; then
+ TMPDIR="$(create_tmp_directory)"
+ PREVDIR="$(pwd)"
+
+ echo >&2 "Entering ${TMPDIR}"
+ cd "${TMPDIR}"
+
+ download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
+ download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.gz.run"
+ if ! grep netdata-latest.gz.run "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - >/dev/null 2>&1; then
+ fatal "Static binary checksum validation failed. Stopping netdata installation and leaving binary in ${TMPDIR}"
+ fi
+
+ # Do not pass any options other than the accept, for now
+ sh "${TMPDIR}/netdata-latest.gz.run" --accept
+
+ #shellcheck disable=SC2181
+ if [ $? -eq 0 ]; then
+ rm -r "${TMPDIR}"
+ else
+ echo >&2 "NOTE: did not remove: ${TMPDIR}"
+ fi
+ echo >&2 "Switching back to ${PREVDIR}"
+ cd "${PREVDIR}"
+else
+ # the installer updates this script - so we run and exit in a single line
+ update && exit 0
+fi
-# the installer updates this script - so we run and exit in a single line
-update && exit 0