diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:45:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:45:55 +0000 |
commit | a8220ab2d293bb7f4b014b79d16b2fb05090fa93 (patch) | |
tree | 77f0a30f016c0925cf7ee9292e644bba183c2774 /packaging/makeself/jobs | |
parent | Adding upstream version 1.19.0. (diff) | |
download | netdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.tar.xz netdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.zip |
Adding upstream version 1.29.0.upstream/1.29.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/makeself/jobs')
-rwxr-xr-x | packaging/makeself/jobs/10-prepare-destination.install.sh | 17 | ||||
-rwxr-xr-x | packaging/makeself/jobs/20-openssl.install.sh | 20 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-bash-5.0.install.sh | 33 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-curl-7.73.0.install.sh | 36 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-fping-5.0.install.sh | 30 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-ioping-1.2.install.sh | 18 | ||||
-rwxr-xr-x | packaging/makeself/jobs/70-netdata-git.install.sh | 50 | ||||
-rwxr-xr-x | packaging/makeself/jobs/99-makeself.install.sh | 101 |
8 files changed, 305 insertions, 0 deletions
diff --git a/packaging/makeself/jobs/10-prepare-destination.install.sh b/packaging/makeself/jobs/10-prepare-destination.install.sh new file mode 100755 index 000000000..8cce2d442 --- /dev/null +++ b/packaging/makeself/jobs/10-prepare-destination.install.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +[ -d "${NETDATA_INSTALL_PATH}.old" ] && run rm -rf "${NETDATA_INSTALL_PATH}.old" +[ -d "${NETDATA_INSTALL_PATH}" ] && run mv -f "${NETDATA_INSTALL_PATH}" "${NETDATA_INSTALL_PATH}.old" + +run mkdir -p "${NETDATA_INSTALL_PATH}/bin" +run mkdir -p "${NETDATA_INSTALL_PATH}/usr" +run cd "${NETDATA_INSTALL_PATH}" +run ln -s bin sbin +run cd "${NETDATA_INSTALL_PATH}/usr" +run ln -s ../bin bin +run ln -s ../sbin sbin +run ln -s . local diff --git a/packaging/makeself/jobs/20-openssl.install.sh b/packaging/makeself/jobs/20-openssl.install.sh new file mode 100755 index 000000000..10863f90f --- /dev/null +++ b/packaging/makeself/jobs/20-openssl.install.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +version="$(cat "$(dirname "${0}")/../openssl.version")" + +export LDFLAGS='-static' +export PKG_CONFIG="pkg-config --static" + +# Might be bind-mounted +if [ ! -d "${NETDATA_MAKESELF_PATH}/tmp/openssl" ]; then + run git clone --branch "${version}" --single-branch git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl" +fi +cd "${NETDATA_MAKESELF_PATH}/tmp/openssl" || exit 1 + +run ./config no-shared no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl +run make -j "$(nproc)" +run make -j "$(nproc)" install_sw diff --git a/packaging/makeself/jobs/50-bash-5.0.install.sh b/packaging/makeself/jobs/50-bash-5.0.install.sh new file mode 100755 index 000000000..a204c1575 --- /dev/null +++ b/packaging/makeself/jobs/50-bash-5.0.install.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +fetch "bash-5.0" "http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz" + +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" + +run ./configure \ + --prefix="${NETDATA_INSTALL_PATH}" \ + --without-bash-malloc \ + --enable-static-link \ + --enable-net-redirections \ + --enable-array-variables \ + --disable-profiling \ + --disable-nls + +run make clean +run make -j "$(nproc)" + +cat > examples/loadables/Makefile << EOF +all: +clean: +install: +EOF + +run make install + +if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/bin/bash +fi diff --git a/packaging/makeself/jobs/50-curl-7.73.0.install.sh b/packaging/makeself/jobs/50-curl-7.73.0.install.sh new file mode 100755 index 000000000..4a9505e58 --- /dev/null +++ b/packaging/makeself/jobs/50-curl-7.73.0.install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +fetch "curl-7.73.0" "https://curl.haxx.se/download/curl-7.73.0.tar.gz" + +export CFLAGS="-I/openssl-static/include" +export LDFLAGS="-static -L/openssl-static/lib" +export PKG_CONFIG="pkg-config --static" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" + +run autoreconf -fi + +run ./configure \ + --prefix="${NETDATA_INSTALL_PATH}" \ + --enable-optimize \ + --disable-shared \ + --enable-static \ + --enable-http \ + --enable-proxy \ + --enable-ipv6 \ + --enable-cookies \ + --with-ca-fallback + +# Curl autoconf does not honour the curl_LDFLAGS environment variable +run sed -i -e "s/curl_LDFLAGS =/curl_LDFLAGS = -all-static/" src/Makefile + +run make clean +run make -j "$(nproc)" +run make install + +if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/bin/curl +fi diff --git a/packaging/makeself/jobs/50-fping-5.0.install.sh b/packaging/makeself/jobs/50-fping-5.0.install.sh new file mode 100755 index 000000000..e62c47e45 --- /dev/null +++ b/packaging/makeself/jobs/50-fping-5.0.install.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +fetch "fping-5.0" "https://fping.org/dist/fping-5.0.tar.gz" + +export CFLAGS="-static -I/openssl-static/include" +export LDFLAGS="-static -L/openssl-static/lib" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" + +run ./configure \ + --prefix="${NETDATA_INSTALL_PATH}" \ + --enable-ipv4 \ + --enable-ipv6 + +cat > doc/Makefile << EOF +all: +clean: +install: +EOF + +run make clean +run make -j "$(nproc)" +run make install + +if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/bin/fping +fi diff --git a/packaging/makeself/jobs/50-ioping-1.2.install.sh b/packaging/makeself/jobs/50-ioping-1.2.install.sh new file mode 100755 index 000000000..22f26914a --- /dev/null +++ b/packaging/makeself/jobs/50-ioping-1.2.install.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +fetch "ioping-1.2" "https://github.com/koct9i/ioping/archive/v1.2.tar.gz" + +export CFLAGS="-static" + +run make clean +run make -j "$(nproc)" +run mkdir -p "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ +run install -o root -g root -m 4750 ioping "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ + +if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ioping +fi diff --git a/packaging/makeself/jobs/70-netdata-git.install.sh b/packaging/makeself/jobs/70-netdata-git.install.sh new file mode 100755 index 000000000..21d4fd0ac --- /dev/null +++ b/packaging/makeself/jobs/70-netdata-git.install.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=./packaging/makeself/functions.sh +. "${NETDATA_MAKESELF_PATH}"/functions.sh "${@}" || exit 1 + +cd "${NETDATA_SOURCE_PATH}" || exit 1 + +if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then + export CFLAGS="-static -O3 -I/openssl-static/include" +else + export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include" +fi + +export LDFLAGS="-static -L/openssl-static/lib" + +# We export this to 'yes', installer sets this to .environment. +# The updater consumes this one, so that it can tell whether it should update a static install or a non-static one +export IS_NETDATA_STATIC_BINARY="yes" + +# Set eBPF LIBC to "static" to bundle the `-static` variant of the kernel-collector +export EBPF_LIBC="static" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" + +# Set correct CMake flags for building against non-System OpenSSL +# See: https://github.com/warmcat/libwebsockets/blob/master/READMEs/README.build.md +export CMAKE_FLAGS="-DOPENSSL_ROOT_DIR=/openssl-static -DOPENSSL_LIBRARIES=/openssl-static/lib -DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/openssl-static -DLWS_OPENSSL_INCLUDE_DIRS=/openssl-static/include -DLWS_OPENSSL_LIBRARIES=/openssl-static/lib/libssl.a;/openssl-static/lib/libcrypto.a" + +run ./netdata-installer.sh \ + --install "${NETDATA_INSTALL_PARENT}" \ + --dont-wait \ + --dont-start-it \ + --require-cloud \ + --dont-scrub-cflags-even-though-it-may-break-things + +# Remove the netdata.conf file from the tree. It has hard-coded sensible defaults builtin. +run rm -f "${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf" + +# Ensure the netdata binary is in fact statically linked +if run readelf -l "${NETDATA_INSTALL_PATH}"/bin/netdata | grep 'INTERP'; then + printf >&2 "Ooops. %s is not a statically linked binary!\n" "${NETDATA_INSTALL_PATH}"/bin/netdata + ldd "${NETDATA_INSTALL_PATH}"/bin/netdata + exit 1 +fi + +if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/bin/netdata + run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/apps.plugin + run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/cgroup-network +fi diff --git a/packaging/makeself/jobs/99-makeself.install.sh b/packaging/makeself/jobs/99-makeself.install.sh new file mode 100755 index 000000000..de641027b --- /dev/null +++ b/packaging/makeself/jobs/99-makeself.install.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +run cd "${NETDATA_SOURCE_PATH}" || exit 1 + +# ----------------------------------------------------------------------------- +# find the netdata version + +VERSION="$(git describe 2> /dev/null)" +if [ -z "${VERSION}" ]; then + VERSION=$(cat packaging/version) +fi + +if [ "${VERSION}" == "" ]; then + echo >&2 "Cannot find version number. Create makeself executable from source code with git tree structure." + exit 1 +fi + +# ----------------------------------------------------------------------------- +# copy the files needed by makeself installation + +run mkdir -p "${NETDATA_INSTALL_PATH}/system" + +run cp \ + packaging/makeself/post-installer.sh \ + packaging/makeself/install-or-update.sh \ + packaging/installer/functions.sh \ + configs.signatures \ + system/netdata-init-d \ + system/netdata-lsb \ + system/netdata-openrc \ + system/netdata.logrotate \ + system/netdata.service \ + "${NETDATA_INSTALL_PATH}/system/" + +# ----------------------------------------------------------------------------- +# create a wrapper to start our netdata with a modified path + +run mkdir -p "${NETDATA_INSTALL_PATH}/bin/srv" + +run mv "${NETDATA_INSTALL_PATH}/bin/netdata" \ + "${NETDATA_INSTALL_PATH}/bin/srv/netdata" || exit 1 + +cat > "${NETDATA_INSTALL_PATH}/bin/netdata" << EOF +#!${NETDATA_INSTALL_PATH}/bin/bash +export NETDATA_BASH_LOADABLES="DISABLE" +export PATH="${NETDATA_INSTALL_PATH}/bin:\${PATH}" +exec "${NETDATA_INSTALL_PATH}/bin/srv/netdata" "\${@}" +EOF +run chmod 755 "${NETDATA_INSTALL_PATH}/bin/netdata" + +# ----------------------------------------------------------------------------- +# copy the SSL/TLS configuration and certificates from the build system + +run cp -a /etc/ssl "${NETDATA_INSTALL_PATH}/share/ssl" + +# ----------------------------------------------------------------------------- +# remove the links to allow untaring the archive + +run rm "${NETDATA_INSTALL_PATH}/sbin" \ + "${NETDATA_INSTALL_PATH}/usr/bin" \ + "${NETDATA_INSTALL_PATH}/usr/sbin" \ + "${NETDATA_INSTALL_PATH}/usr/local" + +# ----------------------------------------------------------------------------- +# create the makeself archive + +run sed "s|NETDATA_VERSION|${VERSION}|g" < "${NETDATA_MAKESELF_PATH}/makeself.lsm" > "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" + +run "${NETDATA_MAKESELF_PATH}/makeself.sh" \ + --gzip \ + --complevel 9 \ + --notemp \ + --needroot \ + --target "${NETDATA_INSTALL_PATH}" \ + --header "${NETDATA_MAKESELF_PATH}/makeself-header.sh" \ + --lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" \ + --license "${NETDATA_MAKESELF_PATH}/makeself-license.txt" \ + --help-header "${NETDATA_MAKESELF_PATH}/makeself-help-header.txt" \ + "${NETDATA_INSTALL_PATH}" \ + "${NETDATA_INSTALL_PATH}.gz.run" \ + "netdata, the real-time performance and health monitoring system" \ + ./system/post-installer.sh + +run rm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" + +# ----------------------------------------------------------------------------- +# copy it to the netdata build dir + +FILE="netdata-${VERSION}.gz.run" + +run mkdir -p artifacts +run mv "${NETDATA_INSTALL_PATH}.gz.run" "artifacts/${FILE}" + +[ -f netdata-latest.gz.run ] && rm netdata-latest.gz.run +run ln -s "artifacts/${FILE}" netdata-latest.gz.run + +echo >&2 "Self-extracting installer moved to 'artifacts/${FILE}'" |