summaryrefslogtreecommitdiffstats
path: root/packaging/installer/netdata-updater.sh
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rwxr-xr-x[-rw-r--r--]packaging/installer/netdata-updater.sh48
1 files changed, 33 insertions, 15 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh
index 56c837953..21a769ba5 100644..100755
--- a/packaging/installer/netdata-updater.sh
+++ b/packaging/installer/netdata-updater.sh
@@ -67,6 +67,12 @@ download() {
}
set_tarball_urls() {
+
+ if [ ! -z "${NETDATA_LOCAL_TARBAL_OVERRIDE}" ]; then
+ info "Not fetching remote tarballs, local override was given"
+ return
+ fi
+
if [ "$1" == "stable" ]; then
local latest
# Simple version
@@ -83,22 +89,34 @@ set_tarball_urls() {
update() {
[ -z "${logfile}" ] && info "Running on a terminal - (this script also supports running headless from crontab)"
- dir=$(create_tmp_directory)
- cd "$dir"
+ RUN_INSTALLER=0
+ tmpdir=$(create_tmp_directory)
+ cd "$tmpdir"
- download "${NETDATA_TARBALL_CHECKSUM_URL}" "${dir}/sha256sum.txt" >&3 2>&3
- if grep "${NETDATA_TARBALL_CHECKSUM}" sha256sum.txt >&3 2>&3; then
- info "Newest version is already installed"
- else
- download "${NETDATA_TARBALL_URL}" "${dir}/netdata-latest.tar.gz"
- 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}"
+ if [ -z "${NETDATA_LOCAL_TARBAL_OVERRIDE}" ]; then
+ download "${NETDATA_TARBALL_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt" >&3 2>&3
+ if grep "${NETDATA_TARBALL_CHECKSUM}" sha256sum.txt >&3 2>&3; then
+ info "Newest version is already installed"
+ else
+ download "${NETDATA_TARBALL_URL}" "${tmpdir}/netdata-latest.tar.gz"
+ 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 ${tmpdir}"
+ fi
+ 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-*
+ RUN_INSTALLER=1
fi
- 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-*
+ else
+ info "!!Local tarball override detected!! - Entering directory ${NETDATA_LOCAL_TARBAL_OVERRIDE} for installation, not downloading anything"
+ RUN_INSTALLER=1
+ cd ${NETDATA_LOCAL_TARBAL_OVERRIDE}
+ fi
+
+ # We got the sources, run the update now
+ if [ ${RUN_INSTALLER} -eq 1 ]; then
# signal netdata to start saving its database
# this is handy if your database is big
pids=$(pidof netdata)
@@ -119,9 +137,9 @@ NETDATA_TARBALL_CHECKSUM="$NEW_CHECKSUM"
EOF
fi
- rm -rf "${dir}" >&3 2>&3
+ rm -rf "${tmpdir}" >&3 2>&3
[ -n "${logfile}" ] && rm "${logfile}" && logfile=
- return 0
+ return
}
# Usually stored in /etc/netdata/.environment