258
"--disable-go") NETDATA_DISABLE_GO=1 ;;
259
"--enable-ebpf") NETDATA_ENABLE_EBPF=1 ;;
260
"--disable-cloud")
261
- NETDATA_DISABLE_LIBMOSQUITTO=1
261
+ NETDATA_DISABLE_CLOUD=1
262
NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-aclk/} --disable-aclk"
263
;;
264
"--install")
435
436
# -----------------------------------------------------------------------------
437
438
-fetch_libmosquitto() {
439
- download_tarball "${1}" "${2}" "libmosquitto" "cloud"
440
-}
441
-
438
build_libmosquitto() {
439
run make -C "${1}/lib"
440
}
449
}
450
451
bundle_libmosquitto() {
456
- if [ -n "${NETDATA_DISABLE_LIBMOSQUITTO}" ]; then
452
+ if [ -n "${NETDATA_DISABLE_CLOUD}" ]; then
453
return 0
454
fi
455
466
tmp="$(mktemp -d -t netdata-mosquitto-XXXXXX)"
467
MOSQUITTO_PACKAGE_BASENAME="${MOSQUITTO_PACKAGE_VERSION}.tar.gz"
468
473
- if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}" ]; then
474
- fetch_libmosquitto "https://github.com/netdata/mosquitto/archive/${MOSQUITTO_PACKAGE_BASENAME}" "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}"
469
+ if fetch_and_verify "mosquitto" \
470
+ "https://github.com/netdata/mosquitto/archive/${MOSQUITTO_PACKAGE_BASENAME}" \
471
+ "${MOSQUITTO_PACKAGE_BASENAME}" \
472
+ "${tmp}" \
473
+ "${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}"
474
+ then
475
+ if run tar -xf "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" -C "${tmp}" && \
476
+ build_libmosquitto "${tmp}/mosquitto-${MOSQUITTO_PACKAGE_VERSION}" && \
477
+ copy_libmosquitto "${tmp}/mosquitto-${MOSQUITTO_PACKAGE_VERSION}" && \
478
+ rm -rf "${tmp}"
479
+ then
480
+ run_ok "libmosquitto built and prepared."
481
+ else
482
+ run_failed "Failed to build libmosquitto. The install process will continue, but you will not be able to connect this node to Netdata Cloud."
483
+ fi
484
else
476
- progress "Using provided mosquitto tarball ${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}"
477
- run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}" "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}"
485
+ run_failed "Unable to fetch sources for libmosquitto. The install process will continue, but you will not be able to connect this node to Netdata Cloud."
486
fi
487
+}
488
480
- if [ ! -f "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" ] || [ ! -s "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" ]; then
481
- run_failed "unable to find a usable libmosquitto source archive, Netdata Cloud will not be available"
482
- return 0
483
- fi
489
+bundle_libmosquitto
490
485
- grep "${MOSQUITTO_PACKAGE_BASENAME}\$" "${INSTALLER_DIR}/packaging/mosquitto.checksums" > "${tmp}/sha256sums.txt" 2> /dev/null
491
+# -----------------------------------------------------------------------------
492
487
- # Checksum validation
488
- if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
489
- run_failed "mosquitto files checksum validation failed."
493
+build_libwebsockets() {
494
+ pushd "${1}" > /dev/null || exit 1
495
+ cmake -D LWS_WITH_SOCKS5:bool=ON .
496
+ make
497
+ popd > /dev/null || exit 1
498
+}
499
+
500
+copy_libwebsockets() {
501
+ target_dir="${PWD}/externaldeps/libwebsockets"
502
+
503
+ run mkdir -p "${target_dir}" || return 1
504
+
505
+ run cp "${1}/lib/libwebsockets.a" "${target_dir}/libwebsockets.a" || return 1
506
+ run cp -r "${1}/include" "${target_dir}" || return 1
507
+}
508
+
509
+bundle_libwebsockets() {
510
+ if [ -n "${DISABLE_CLOUD}" ] ; then
511
return 0
512
fi
513
493
- run tar -xf "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" -C "${tmp}"
494
-
495
- build_libmosquitto "${tmp}/mosquitto-${MOSQUITTO_PACKAGE_VERSION}" && copy_libmosquitto "${tmp}/mosquitto-${MOSQUITTO_PACKAGE_VERSION}" && rm "${tmp}"
514
+ progress "Prepare libwebsockets"
515
+
516
+ LIBWEBSOCKETS_PACKAGE_VERSION="$(cat packaging/libwebsockets.version)"
517
+
518
+ tmp="$(mktemp -d -t netdata-libwebsockets-XXXXXX)"
519
+ LIBWEBSOCKETS_PACKAGE_BASENAME="v${LIBWEBSOCKETS_PACKAGE_VERSION}.tar.gz"
520
+
521
+ if fetch_and_verify "libwebsockets" \
522
+ "https://github.com/warmcat/libwebsockets/archive/${LIBWEBSOCKETS_PACKAGE_BASENAME}" \
523
+ "${LIBWEBSOCKETS_PACKAGE_BASENAME}" \
524
+ "${tmp}" \
525
+ "${NETDATA_LOCAL_TARBALL_OVERRIDE_LIBWEBSOCKETS}"
526
+ then
527
+ if run tar -xf "${tmp}/${LIBWEBSOCKETS_PACKAGE_BASENAME}" -C "${tmp}" && \
528
+ build_libwebsockets "${tmp}/libwebsockets-${LIBWEBSOCKETS_PACKAGE_VERSION}" && \
529
+ copy_libwebsockets "${tmp}/libwebsockets-${LIBWEBSOCKETS_PACKAGE_VERSION}" && \
530
+ rm -rf "${tmp}"
531
+ then
532
+ run_ok "libwebsockets built and prepared."
533
+ else
534
+ run_failed "Failed to build libwebsockets. The install process will continue, but you may not be able to connect this node to Netdata Cloud."
535
+ fi
536
+ else
537
+ run_failed "Unable to fetch sources for libwebsockets. The install process will continue, but you may not be able to connect this node to Netdata Cloud."
538
+ fi
539
}
540
498
-bundle_libmosquitto
541
+bundle_libwebsockets
542
543
# -----------------------------------------------------------------------------
544
echo >&2