diff options
-rwxr-xr-x | netdata-installer.sh | 80 | ||||
-rw-r--r-- | packaging/mosquitto.checksums | 1 | ||||
-rw-r--r-- | packaging/mosquitto.version | 1 |
3 files changed, 79 insertions, 3 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index a2549c20e9..bdc30a7d94 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -26,6 +26,12 @@ if [ "${NETDATA_SOURCE_DIR}" != "${INSTALLER_DIR}" ] && [ "${INSTALLER_DIR}" != fi # ----------------------------------------------------------------------------- +# Pull in OpenSSL properly if on macOS +if [ "$(uname -s)" = 'Darwin' ] && [ -d /usr/local/opt/openssl/include ] ; then + export C_INCLUDE_PATH="/usr/local/opt/openssl/include" +fi + +# ----------------------------------------------------------------------------- # reload the user profile # shellcheck source=/dev/null @@ -45,9 +51,11 @@ else source "${NETDATA_SOURCE_DIR}/packaging/installer/functions.sh" || exit 1 fi -download_go() { +download_tarball() { url="${1}" dest="${2}" + name="${3}" + opt="${4}" if command -v curl > /dev/null 2>&1; then run curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}" @@ -55,14 +63,18 @@ download_go() { run wget -T 15 -O - "${url}" > "${dest}" else echo >&2 - echo >&2 "Downloading go.d plugin from '${url}' failed because of missing mandatory packages." - echo >&2 "Either add packages or disable it by issuing '--disable-go' in the installer" + echo >&2 "Downloading ${name} from '${url}' failed because of missing mandatory packages." + echo >&2 "Either add packages or disable it by issuing '--disable-${opt}' in the installer" echo >&2 run_failed "I need curl or wget to proceed, but neither is available on this system." fi } +download_go() { + download_tarball "${1}" "${2}" "go.d plugin" "go" +} + # make sure we save all commands we run run_logfile="netdata-installer.log" @@ -157,6 +169,7 @@ USAGE: ${PROGRAM} [options] --nightly-channel Use most recent nightly udpates instead of GitHub releases. This results in more frequent updates. --disable-go Disable installation of go.d.plugin. + --disable-cloud Disable the agent-cloud link, required for Netdata Cloud functionality. --enable-plugin-freeipmi Enable the FreeIPMI plugin. Default: enable it when libipmimonitoring is available. --disable-plugin-freeipmi --disable-https Explicitly disable TLS support @@ -241,6 +254,7 @@ while [ -n "${1}" ]; do "--disable-x86-sse") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-x86-sse/} --disable-x86-sse" ;; "--disable-telemetry") NETDATA_DISABLE_TELEMETRY=1 ;; "--disable-go") NETDATA_DISABLE_GO=1 ;; + "--disable-cloud") NETDATA_DISABLE_LIBMOSQUITTO=1 ; NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-aclk/} --disable-aclk" ;; "--install") NETDATA_PREFIX="${2}/netdata" shift 1 @@ -414,6 +428,66 @@ fi trap build_error EXIT # ----------------------------------------------------------------------------- + +fetch_libmosquitto() { + download_tarball "${1}" "${2}" "libmosquitto" "cloud" +} + +build_libmosquitto() { + run make -C "${1}/lib" +} + +copy_libmosquitto() { + target_dir="${PWD}/externaldeps/mosquitto" + + run mkdir -p "${target_dir}" + + run cp "${1}/lib/libmosquitto.a" "${target_dir}" + run cp "${1}/lib/mosquitto.h" "${target_dir}" +} + +bundle_libmosquitto() { + if [ -n "${NETDATA_DISABLE_LIBMOSQUITTO}" ] ; then + return 0 + fi + + progress "Prepare custom libmosquitto version" + + MOSQUITTO_PACKAGE_VERSION="$(cat packaging/mosquitto.version)" + + tmp=$(mktemp -d netdata-mosquitto-XXXXXX) + MOSQUITTO_PACKAGE_BASENAME="${MOSQUITTO_PACKAGE_VERSION}.tar.gz" + + if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}" ]; then + fetch_libmosquitto "https://github.com/netdata/mosquitto/archive/${MOSQUITTO_PACKAGE_BASENAME}" "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" + else + progress "Using provided mosquitto tarball ${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}" + run cp "${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}" "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" + fi + + if [ ! -f "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" ] || [ ! -s "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" ]; then + run_failed "unable to find a usable libmosquitto source archive, Netdata Cloud will not be available" + return 0 + fi + + grep "${MOSQUITTO_PACKAGE_BASENAME}\$" "${INSTALLER_DIR}/packaging/go.d.checksums" >"${tmp}/sha256sums.txt" 2>/dev/null + + cp packaging/mosquitto.checksums "${tmp}/sha256sums.txt" + + # Checksum validation + if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then + run_failed "mosquitto files checksum validation failed." + return 0 + fi + + run tar -xf "${tmp}/${MOSQUITTO_PACKAGE_BASENAME}" -C "${tmp}" + + build_libmosquitto "${tmp}/mosquitto-${MOSQUITTO_PACKAGE_VERSION}" && copy_libmosquitto "${tmp}/mosquitto-${MOSQUITTO_PACKAGE_VERSION}" && rm "${tmp}" +} + +bundle_libmosquitto + +# ----------------------------------------------------------------------------- echo >&2 progress "Run autotools to configure the build environment" diff --git a/packaging/mosquitto.checksums b/packaging/mosquitto.checksums new file mode 100644 index 0000000000..956a68f190 --- /dev/null +++ b/packaging/mosquitto.checksums @@ -0,0 +1 @@ +1bcf9caaaf28fcc3ede4bccca32c74db5d37139a1f1ba4c6cf1811722fde203b v.1.6.8_Netdata-2.tar.gz diff --git a/packaging/mosquitto.version b/packaging/mosquitto.version new file mode 100644 index 0000000000..42598afc7a --- /dev/null +++ b/packaging/mosquitto.version @@ -0,0 +1 @@ +v.1.6.8_Netdata-2 |