73
}
74
75
set_tarball_urls() {
76
+ local extension="tar.gz"
77
78
if [ ! -z "${NETDATA_LOCAL_TARBAL_OVERRIDE}" ]; then
79
info "Not fetching remote tarballs, local override was given"
80
return
81
fi
82
83
+ if [ "$2" == "yes" ]; then
84
+ extension="gz.run"
85
+ fi
86
+
87
if [ "$1" = "stable" ]; then
88
local latest
89
# Simple version
90
# latest="$(curl -sSL https://api.github.com/repos/netdata/netdata/releases/latest | grep tag_name | cut -d'"' -f4)"
91
latest="$(download "https://api.github.com/repos/netdata/netdata/releases/latest" /dev/stdout | grep tag_name | cut -d'"' -f4)"
87
- export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-$latest.tar.gz"
92
+ export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-$latest.${extension}"
93
export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt"
94
else
90
- export NETDATA_TARBALL_URL="https://storage.googleapis.com/netdata-nightlies/netdata-latest.tar.gz"
95
+ export NETDATA_TARBALL_URL="https://storage.googleapis.com/netdata-nightlies/netdata-latest.${extension}"
96
export NETDATA_TARBALL_CHECKSUM_URL="https://storage.googleapis.com/netdata-nightlies/sha256sums.txt"
97
fi
98
}
176
exec 3>"${logfile}"
177
fi
178
174
-set_tarball_urls "${RELEASE_CHANNEL}"
179
+set_tarball_urls "${RELEASE_CHANNEL}" "${IS_NETDATA_STATIC_BINARY}"
180
+
181
+if [ "${IS_NETDATA_STATIC_BINARY}" == "yes" ]; then
182
+ TMPDIR="$(create_tmp_directory)"
183
+ PREVDIR="$(pwd)"
184
+
185
+ echo >&2 "Entering ${TMPDIR}"
186
+ cd "${TMPDIR}"
187
+
188
+ download "${NETDATA_TARBALL_CHECKSUM_URL}" "${TMPDIR}/sha256sum.txt"
189
+ download "${NETDATA_TARBALL_URL}" "${TMPDIR}/netdata-latest.gz.run"
190
+ if ! grep netdata-latest.gz.run "${TMPDIR}/sha256sum.txt" | safe_sha256sum -c - >/dev/null 2>&1; then
191
+ fatal "Static binary checksum validation failed. Stopping netdata installation and leaving binary in ${TMPDIR}"
192
+ fi
193
+
194
+ # Do not pass any options other than the accept, for now
195
+ sh "${TMPDIR}/netdata-latest.gz.run" --accept
196
+
197
+ #shellcheck disable=SC2181
198
+ if [ $? -eq 0 ]; then
199
+ rm -r "${TMPDIR}"
200
+ else
201
+ echo >&2 "NOTE: did not remove: ${TMPDIR}"
202
+ fi
203
+ echo >&2 "Switching back to ${PREVDIR}"
204
+ cd "${PREVDIR}"
205
+else
206
+ # the installer updates this script - so we run and exit in a single line
207
+ update && exit 0
208
+fi
209
176
-# the installer updates this script - so we run and exit in a single line
177
-update && exit 0