Pull in build dependencies when updating a locally built install. (#12294)
This ensures that as our dependencies change we can still build properly and still have our minimum required dependencies.
Austin S. Hemmelgarn committed
Mar 7, 2022 at 07:07 UTC
e818796806dd958cf57e12a8ca369b036cf0e9a5
1 file changed
+31
packaging/installer/netdata-updater.sh
+31
@@ -30,6 +30,8 @@
30
31
set -e
32
33
+PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh"
34
+
35
script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)"
36
37
if [ -x "${script_dir}/netdata-updater" ]; then
@@ -129,6 +131,33 @@ _get_intervaldir() {
131
return 0
132
}
133
134
+install_build_dependencies() {
135
+ bash="$(command -v bash 2> /dev/null)"
136
+
137
+ if [ -z "${bash}" ] || [ ! -x "${bash}" ]; then
138
+ warning "Unable to find a usable version of \`bash\` (required for local build)."
139
+ return 1
140
+ fi
141
+
142
+ info "Fetching dependency handling script..."
143
+ download "${PACKAGES_SCRIPT}" "${TMPDIR}/install-required-packages.sh" || true
144
+
145
+ if [ ! -s "${TMPDIR}/install-required-packages.sh" ]; then
146
+ warning "Downloaded dependency installation script is empty."
147
+ else
148
+ info "Running dependency handling script..."
149
+
150
+ if [ "${INTERACTIVE}" -eq 0 ]; then
151
+ opts="--dont-wait --non-interactive"
152
+ fi
153
+
154
+ # shellcheck disable=SC2086
155
+ if ! run "${bash}" "${TMPDIR}/install-required-packages.sh" ${opts} netdata; then
156
+ warning "Installing build dependencies failed. The update should still work, but you might be missing some features."
157
+ fi
158
+ fi
159
+}
160
+
161
enable_netdata_updater() {
162
updater_type="$(echo "${1}" | tr '[:upper:]' '[:lower:]')"
163
case "${updater_type}" in
@@ -475,6 +504,8 @@ set_tarball_urls() {
504
update_build() {
505
[ -z "${logfile}" ] && info "Running on a terminal - (this script also supports running headless from crontab)"
506
507
+ install_build_dependencies
508
+
509
RUN_INSTALLER=0
510
ndtmpdir=$(create_tmp_directory)
511
cd "$ndtmpdir" || exit 1