0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-24 05:13:08 +00:00

Add support for eBPF for Netdata static64 (kickstart-static64.sh) ()

* Add tool to build the dist and static x864_64 artifacts

* Add tool to bump the Netdata packaging version

* Cleanup all the makeself scripts and update to Alpine 3.11

* Add zgrep and xz to Alpine 3.7 container used to build x86_64 static Netdata so check-kernel-config.sh does not fail

* Explicitly bundle the -static varient of the eBPF kernel-collector library/programs
This commit is contained in:
James Mills 2020-05-29 12:27:22 +10:00 committed by GitHub
parent aff16a2dfa
commit 5087294d81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 219 additions and 161 deletions

78
.github/scripts/build-artifacts.sh vendored Executable file
View file

@ -0,0 +1,78 @@
#!/bin/sh
#
# Builds the netdata-vX.y.Z-xxxx.tar.gz source tarball (dist)
# and netdata-vX.Y.Z-xxxx.gz.run (static x86_64) artifacts.
set -e
# shellcheck source=.github/scripts/functions.sh
. "$(dirname "$0")/functions.sh"
NAME="${NAME:-netdata}"
VERSION="${VERSION:-"$(git describe)"}"
BASENAME="$NAME-$VERSION"
prepare_build() {
progress "Preparing build"
(
test -d artifacts || mkdir -p artifacts
) >&2
}
build_dist() {
progress "Building dist"
(
autoreconf -ivf
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/libexec \
--with-zlib \
--with-math \
--with-user=netdata \
CFLAGS=-O2
make dist
mv "${BASENAME}.tar.gz" artifacts/
) >&2
}
build_static_x86_64() {
progress "Building static x86_64"
(
USER="" ./packaging/makeself/build-x86_64-static.sh
) >&2
}
prepare_assets() {
progress "Preparing assets"
(
cp packaging/version artifacts/latest-version.txt
cd artifacts || exit 1
ln -s "${BASENAME}.tar.gz" netdata-latest.tar.gz
ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
sha256sum -b ./* > "sha256sums.txt"
) >&2
}
steps="prepare_build build_dist build_static_x86_64"
steps="$steps prepare_assets"
_main() {
for step in $steps; do
if ! run "$step"; then
if [ -t 1 ]; then
debug
else
fail "Build failed"
fi
fi
done
echo "🎉 All Done!"
}
if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
_main "$@"
fi

6
.github/scripts/bump-packaging-version.sh vendored Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
VERSION="$(git describe)"
echo "$VERSION" > packaging/version
git add -A
git ci -m "[netdata nightly] $VERSION"

View file

@ -1355,7 +1355,7 @@ install_ebpf() {
progress "Installing eBPF plugin" progress "Installing eBPF plugin"
# Detect libc # Detect libc
libc="$(detect_libc)" libc="${EBPF_LIBC:-"$(detect_libc)"}"
EBPF_VERSION="$(cat packaging/ebpf.version)" EBPF_VERSION="$(cat packaging/ebpf.version)"
EBPF_TARBALL="netdata-kernel-collector-${libc}-${EBPF_VERSION}.tar.xz" EBPF_TARBALL="netdata-kernel-collector-${libc}-${EBPF_VERSION}.tar.xz"

View file

@ -202,6 +202,11 @@ safe_pidof() {
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
find_processors() { find_processors() {
# Most UNIX systems have `nproc` as part of their userland (including macOS, Linux and BSD)
if command -v nproc > /dev/null; then
nproc && return
fi
local cpus local cpus
if [ -f "/proc/cpuinfo" ]; then if [ -f "/proc/cpuinfo" ]; then
# linux # linux

View file

@ -4,6 +4,8 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# parse command line arguments # parse command line arguments
set -e
export NETDATA_BUILD_WITH_DEBUG=0 export NETDATA_BUILD_WITH_DEBUG=0
while [ -n "${1}" ]; do while [ -n "${1}" ]; do
@ -37,18 +39,14 @@ if [ ! -f ../../netdata-installer.sh ]; then
fi fi
cat >&2 << EOF cat >&2 << EOF
This program will create a self-extracting shell package containing This program will create a self-extracting shell package containing
a statically linked netdata, able to run on any 64bit Linux system, a statically linked netdata, able to run on any 64bit Linux system,
without any dependencies from the target system. without any dependencies from the target system.
It can be used to have netdata running in no-time, or in cases the It can be used to have netdata running in no-time, or in cases the
target Linux system cannot compile netdata. target Linux system cannot compile netdata.
EOF EOF
# read -p "Press ENTER to continue > "
if [ ! -d tmp ]; then if [ ! -d tmp ]; then
mkdir tmp || exit 1 mkdir tmp || exit 1
fi fi

View file

@ -6,19 +6,20 @@
# allow running the jobs by hand # allow running the jobs by hand
[ -z "${NETDATA_BUILD_WITH_DEBUG}" ] && export NETDATA_BUILD_WITH_DEBUG=0 [ -z "${NETDATA_BUILD_WITH_DEBUG}" ] && export NETDATA_BUILD_WITH_DEBUG=0
[ -z "${NETDATA_INSTALL_PATH}" ] && export NETDATA_INSTALL_PATH="${1-/opt/netdata}" [ -z "${NETDATA_INSTALL_PATH}" ] && export NETDATA_INSTALL_PATH="${1-/opt/netdata}"
[ -z "${NETDATA_MAKESELF_PATH}" ] && export NETDATA_MAKESELF_PATH="$(dirname "${0}")/../.." [ -z "${NETDATA_MAKESELF_PATH}" ] && NETDATA_MAKESELF_PATH="$(dirname "${0}")/../.."
[ "${NETDATA_MAKESELF_PATH:0:1}" != "/" ] && export NETDATA_MAKESELF_PATH="$(pwd)/${NETDATA_MAKESELF_PATH}" [ "${NETDATA_MAKESELF_PATH:0:1}" != "/" ] && NETDATA_MAKESELF_PATH="$(pwd)/${NETDATA_MAKESELF_PATH}"
[ -z "${NETDATA_SOURCE_PATH}" ] && export NETDATA_SOURCE_PATH="${NETDATA_MAKESELF_PATH}/../.." [ -z "${NETDATA_SOURCE_PATH}" ] && export NETDATA_SOURCE_PATH="${NETDATA_MAKESELF_PATH}/../.."
export NETDATA_MAKESELF_PATH NETDATA_MAKESELF_PATH
export NULL= export NULL=
# make sure the path does not end with / # make sure the path does not end with /
if [ "${NETDATA_INSTALL_PATH:$(( ${#NETDATA_INSTALL_PATH} - 1)):1}" = "/" ] if [ "${NETDATA_INSTALL_PATH:$((${#NETDATA_INSTALL_PATH} - 1)):1}" = "/" ]; then
then export NETDATA_INSTALL_PATH="${NETDATA_INSTALL_PATH:0:$((${#NETDATA_INSTALL_PATH} - 1))}"
export NETDATA_INSTALL_PATH="${NETDATA_INSTALL_PATH:0:$(( ${#NETDATA_INSTALL_PATH} - 1))}"
fi fi
# find the parent directory # find the parent directory
export NETDATA_INSTALL_PARENT="$(dirname "${NETDATA_INSTALL_PATH}")" NETDATA_INSTALL_PARENT="$(dirname "${NETDATA_INSTALL_PATH}")"
export NETDATA_INSTALL_PARENT
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -28,27 +29,26 @@ set -euo pipefail
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
fetch() { fetch() {
local dir="${1}" url="${2}" local dir="${1}" url="${2}"
local tar="${dir}.tar.gz" local tar="${dir}.tar.gz"
if [ ! -f "${NETDATA_MAKESELF_PATH}/tmp/${tar}" ] if [ ! -f "${NETDATA_MAKESELF_PATH}/tmp/${tar}" ]; then
then run wget -O "${NETDATA_MAKESELF_PATH}/tmp/${tar}" "${url}"
run wget -O "${NETDATA_MAKESELF_PATH}/tmp/${tar}" "${url}" fi
fi
if [ ! -d "${NETDATA_MAKESELF_PATH}/tmp/${dir}" ] if [ ! -d "${NETDATA_MAKESELF_PATH}/tmp/${dir}" ]; then
then cd "${NETDATA_MAKESELF_PATH}/tmp"
cd "${NETDATA_MAKESELF_PATH}/tmp" run tar -zxpf "${tar}"
run tar -zxpf "${tar}" cd -
cd - fi
fi
run cd "${NETDATA_MAKESELF_PATH}/tmp/${dir}" run cd "${NETDATA_MAKESELF_PATH}/tmp/${dir}"
} }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# load the functions of the netdata-installer.sh # load the functions of the netdata-installer.sh
# shellcheck source=packaging/installer/functions.sh
. "${NETDATA_SOURCE_PATH}/packaging/installer/functions.sh" . "${NETDATA_SOURCE_PATH}/packaging/installer/functions.sh"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -59,4 +59,4 @@ echo "NETDATA_INSTALL_PARENT=${NETDATA_INSTALL_PARENT}"
echo "NETDATA_INSTALL_PATH=${NETDATA_INSTALL_PATH}" echo "NETDATA_INSTALL_PATH=${NETDATA_INSTALL_PATH}"
echo "NETDATA_MAKESELF_PATH=${NETDATA_MAKESELF_PATH}" echo "NETDATA_MAKESELF_PATH=${NETDATA_MAKESELF_PATH}"
echo "NETDATA_SOURCE_PATH=${NETDATA_SOURCE_PATH}" echo "NETDATA_SOURCE_PATH=${NETDATA_SOURCE_PATH}"
echo "PROCESSORS=$(find_processors)" echo "PROCESSORS=$(nproc)"

View file

@ -7,11 +7,8 @@
# #
# Author: Paul Emm. Katsoulakis <paul@netdata.cloud> # Author: Paul Emm. Katsoulakis <paul@netdata.cloud>
# Packaging update
apk update
# Add required APK packages # Add required APK packages
apk add --no-cache \ apk add --no-cache -U \
bash \ bash \
wget \ wget \
curl \ curl \
@ -37,28 +34,27 @@ apk add --no-cache \
openssl-dev \ openssl-dev \
snappy-dev \ snappy-dev \
protobuf-dev \ protobuf-dev \
binutils || binutils \
exit 1 gzip \
xz || exit 1
# snappy doesnt have static version in alpine, let's compile it # snappy doesnt have static version in alpine, let's compile it
export SNAPPY_VER="1.1.7" export SNAPPY_VER="1.1.7"
wget -O /snappy.tar.gz https://github.com/google/snappy/archive/${SNAPPY_VER}.tar.gz wget -O /snappy.tar.gz https://github.com/google/snappy/archive/${SNAPPY_VER}.tar.gz
cd / tar -C / -xf /snappy.tar.gz
tar -xf snappy.tar.gz rm /snappy.tar.gz
rm snappy.tar.gz cd /snappy-${SNAPPY_VER} || exit 1
cd /snappy-${SNAPPY_VER}
mkdir build mkdir build
cd build cd build || exit 1
cmake -DCMAKE_BUILD_SHARED_LIBS=true -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR=lib ../ cmake -DCMAKE_BUILD_SHARED_LIBS=true -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR=lib ../
make && make install make && make install
# Judy doesnt seem to be available on the repositories, download manually and install it # Judy doesnt seem to be available on the repositories, download manually and install it
export JUDY_VER="1.0.5" export JUDY_VER="1.0.5"
wget -O /judy.tar.gz http://downloads.sourceforge.net/project/judy/judy/Judy-${JUDY_VER}/Judy-${JUDY_VER}.tar.gz wget -O /judy.tar.gz http://downloads.sourceforge.net/project/judy/judy/Judy-${JUDY_VER}/Judy-${JUDY_VER}.tar.gz
cd / tar -C / -xf /judy.tar.gz
tar -xf judy.tar.gz rm /judy.tar.gz
rm judy.tar.gz cd /judy-${JUDY_VER} || exit 1
cd /judy-${JUDY_VER}
CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" ./configure CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" ./configure
make make
make install make install

View file

@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
. $(dirname "${0}")/../functions.sh "${@}" || exit 1 # 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}.old" ] && run rm -rf "${NETDATA_INSTALL_PATH}.old"
[ -d "${NETDATA_INSTALL_PATH}" ] && run mv -f "${NETDATA_INSTALL_PATH}" "${NETDATA_INSTALL_PATH}.old" [ -d "${NETDATA_INSTALL_PATH}" ] && run mv -f "${NETDATA_INSTALL_PATH}" "${NETDATA_INSTALL_PATH}.old"

View file

@ -1,46 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
. $(dirname "${0}")/../functions.sh "${@}" || exit 1 # shellcheck source=packaging/makeself/functions.sh
. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
fetch "bash-4.4.18" "http://ftp.gnu.org/gnu/bash/bash-4.4.18.tar.gz" fetch "bash-4.4.18" "http://ftp.gnu.org/gnu/bash/bash-4.4.18.tar.gz"
run ./configure \ run ./configure \
--prefix=${NETDATA_INSTALL_PATH} \ --prefix="${NETDATA_INSTALL_PATH}" \
--without-bash-malloc \ --without-bash-malloc \
--enable-static-link \ --enable-static-link \
--enable-net-redirections \ --enable-net-redirections \
--enable-array-variables \ --enable-array-variables \
--disable-profiling \ --disable-profiling \
--disable-nls \ --disable-nls
# --disable-rpath \
# --enable-alias \
# --enable-arith-for-command \
# --enable-array-variables \
# --enable-brace-expansion \
# --enable-casemod-attributes \
# --enable-casemod-expansions \
# --enable-command-timing \
# --enable-cond-command \
# --enable-cond-regexp \
# --enable-directory-stack \
# --enable-dparen-arithmetic \
# --enable-function-import \
# --enable-glob-asciiranges-default \
# --enable-help-builtin \
# --enable-job-control \
# --enable-net-redirections \
# --enable-process-substitution \
# --enable-progcomp \
# --enable-prompt-string-decoding \
# --enable-readline \
# --enable-select \
run make clean run make clean
run make -j$(find_processors) run make -j "$(nproc)"
cat >examples/loadables/Makefile <<EOF cat > examples/loadables/Makefile << EOF
all: all:
clean: clean:
install: install:
@ -48,7 +26,6 @@ EOF
run make install run make install
if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ] if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
then run strip "${NETDATA_INSTALL_PATH}"/bin/bash
run strip ${NETDATA_INSTALL_PATH}/bin/bash
fi fi

View file

@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
. $(dirname "${0}")/../functions.sh "${@}" || exit 1 # shellcheck source=packaging/makeself/functions.sh
. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
fetch "curl-curl-7_60_0" "https://github.com/curl/curl/archive/curl-7_60_0.tar.gz" fetch "curl-curl-7_60_0" "https://github.com/curl/curl/archive/curl-7_60_0.tar.gz"
@ -11,24 +12,22 @@ export PKG_CONFIG="pkg-config --static"
run ./buildconf run ./buildconf
run ./configure \ run ./configure \
--prefix=${NETDATA_INSTALL_PATH} \ --prefix="${NETDATA_INSTALL_PATH}" \
--enable-optimize \ --enable-optimize \
--disable-shared \ --disable-shared \
--enable-static \ --enable-static \
--enable-http \ --enable-http \
--enable-proxy \ --enable-proxy \
--enable-ipv6 \ --enable-ipv6 \
--enable-cookies \ --enable-cookies
${NULL}
# Curl autoconf does not honour the curl_LDFLAGS environment variable # Curl autoconf does not honour the curl_LDFLAGS environment variable
run sed -i -e "s/curl_LDFLAGS =/curl_LDFLAGS = -all-static/" src/Makefile run sed -i -e "s/curl_LDFLAGS =/curl_LDFLAGS = -all-static/" src/Makefile
run make clean run make clean
run make -j$(find_processors) run make -j "$(nproc)"
run make install run make install
if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ] if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
then run strip "${NETDATA_INSTALL_PATH}"/bin/curl
run strip ${NETDATA_INSTALL_PATH}/bin/curl
fi fi

View file

@ -1,29 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
. $(dirname "${0}")/../functions.sh "${@}" || exit 1 # shellcheck source=packaging/makeself/functions.sh
. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
fetch "fping-4.2" "https://github.com/schweikert/fping/releases/download/v4.2/fping-4.2.tar.gz" fetch "fping-4.2" "https://github.com/schweikert/fping/releases/download/v4.2/fping-4.2.tar.gz"
export CFLAGS="-static" export CFLAGS="-static"
run ./configure \ run ./configure \
--prefix=${NETDATA_INSTALL_PATH} \ --prefix="${NETDATA_INSTALL_PATH}" \
--enable-ipv4 \ --enable-ipv4 \
--enable-ipv6 \ --enable-ipv6
${NULL}
cat >doc/Makefile <<EOF cat > doc/Makefile << EOF
all: all:
clean: clean:
install: install:
EOF EOF
run make clean run make clean
run make -j$(find_processors) run make -j "$(nproc)"
run make install run make install
if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ] if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
then run strip "${NETDATA_INSTALL_PATH}"/bin/fping
run strip ${NETDATA_INSTALL_PATH}/bin/fping
fi fi

View file

@ -1,18 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
. $(dirname "${0}")/../functions.sh "${@}" || exit 1 # shellcheck source=packaging/makeself/functions.sh
. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
fetch "netdata-ioping-43d15a5" "https://github.com/netdata/ioping/tarball/master" fetch "netdata-ioping-43d15a5" "https://github.com/netdata/ioping/tarball/master"
export CFLAGS="-static" export CFLAGS="-static"
run make clean run make clean
run make -j$(find_processors) run make -j "$(nproc)"
run mkdir -p ${NETDATA_INSTALL_PATH}/usr/libexec/netdata/plugins.d/ 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/ run install -o root -g root -m 4750 ioping "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/
if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ] if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
then run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ioping
run strip ${NETDATA_INSTALL_PATH}/usr/libexec/netdata/plugins.d/ioping
fi fi

View file

@ -10,17 +10,19 @@ if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
export CFLAGS="-static -O3" export CFLAGS="-static -O3"
else else
export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1" export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1"
# export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness"
fi fi
# We export this to 'yes', installer sets this to .environment. # 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 # 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" export IS_NETDATA_STATIC_BINARY="yes"
run ./netdata-installer.sh --install "${NETDATA_INSTALL_PARENT}" \ # Set eBPF LIBC to "static" to bundle the `-static` variant of the kernel-collector
export EBPF_LIBC="static"
run ./netdata-installer.sh \
--install "${NETDATA_INSTALL_PARENT}" \
--dont-wait \ --dont-wait \
--dont-start-it \ --dont-start-it
"${NULL}"
# Remove the netdata.conf file from the tree. It has hard-coded sensible defaults builtin. # Remove the netdata.conf file from the tree. It has hard-coded sensible defaults builtin.
rm -f "${NETDATA_INSTALL_PARENT}/etc/netdata/netdata.conf" rm -f "${NETDATA_INSTALL_PARENT}/etc/netdata/netdata.conf"

View file

@ -1,21 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
. $(dirname "${0}")/../functions.sh "${@}" || exit 1 # shellcheck source=packaging/makeself/functions.sh
. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
run cd "${NETDATA_SOURCE_PATH}" || exit 1 run cd "${NETDATA_SOURCE_PATH}" || exit 1
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# find the netdata version # find the netdata version
VERSION="$(git describe 2>/dev/null)" VERSION="$(git describe 2> /dev/null)"
if [ -z "${VERSION}" ]; then if [ -z "${VERSION}" ]; then
VERSION=$(cat packaging/version) VERSION=$(cat packaging/version)
fi fi
if [ "${VERSION}" == "" ]; then if [ "${VERSION}" == "" ]; then
echo >&2 "Cannot find version number. Create makeself executable from source code with git tree structure." echo >&2 "Cannot find version number. Create makeself executable from source code with git tree structure."
exit 1 exit 1
fi fi
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -24,17 +25,16 @@ fi
run mkdir -p "${NETDATA_INSTALL_PATH}/system" run mkdir -p "${NETDATA_INSTALL_PATH}/system"
run cp \ run cp \
packaging/makeself/post-installer.sh \ packaging/makeself/post-installer.sh \
packaging/makeself/install-or-update.sh \ packaging/makeself/install-or-update.sh \
packaging/installer/functions.sh \ packaging/installer/functions.sh \
configs.signatures \ configs.signatures \
system/netdata-init-d \ system/netdata-init-d \
system/netdata-lsb \ system/netdata-lsb \
system/netdata-openrc \ system/netdata-openrc \
system/netdata.logrotate \ system/netdata.logrotate \
system/netdata.service \ system/netdata.service \
"${NETDATA_INSTALL_PATH}/system/" "${NETDATA_INSTALL_PATH}/system/"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# create a wrapper to start our netdata with a modified path # create a wrapper to start our netdata with a modified path
@ -42,9 +42,9 @@ run cp \
run mkdir -p "${NETDATA_INSTALL_PATH}/bin/srv" run mkdir -p "${NETDATA_INSTALL_PATH}/bin/srv"
run mv "${NETDATA_INSTALL_PATH}/bin/netdata" \ run mv "${NETDATA_INSTALL_PATH}/bin/netdata" \
"${NETDATA_INSTALL_PATH}/bin/srv/netdata" || exit 1 "${NETDATA_INSTALL_PATH}/bin/srv/netdata" || exit 1
cat >"${NETDATA_INSTALL_PATH}/bin/netdata" <<EOF cat > "${NETDATA_INSTALL_PATH}/bin/netdata" << EOF
#!${NETDATA_INSTALL_PATH}/bin/bash #!${NETDATA_INSTALL_PATH}/bin/bash
export NETDATA_BASH_LOADABLES="DISABLE" export NETDATA_BASH_LOADABLES="DISABLE"
export PATH="${NETDATA_INSTALL_PATH}/bin:\${PATH}" export PATH="${NETDATA_INSTALL_PATH}/bin:\${PATH}"
@ -52,36 +52,33 @@ exec "${NETDATA_INSTALL_PATH}/bin/srv/netdata" "\${@}"
EOF EOF
run chmod 755 "${NETDATA_INSTALL_PATH}/bin/netdata" run chmod 755 "${NETDATA_INSTALL_PATH}/bin/netdata"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# remove the links to allow untaring the archive # remove the links to allow untaring the archive
run rm "${NETDATA_INSTALL_PATH}/sbin" \ run rm "${NETDATA_INSTALL_PATH}/sbin" \
"${NETDATA_INSTALL_PATH}/usr/bin" \ "${NETDATA_INSTALL_PATH}/usr/bin" \
"${NETDATA_INSTALL_PATH}/usr/sbin" \ "${NETDATA_INSTALL_PATH}/usr/sbin" \
"${NETDATA_INSTALL_PATH}/usr/local" "${NETDATA_INSTALL_PATH}/usr/local"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# create the makeself archive # create the makeself archive
run sed "s|NETDATA_VERSION|${VERSION}|g" <"${NETDATA_MAKESELF_PATH}/makeself.lsm" >"${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" run sed "s|NETDATA_VERSION|${VERSION}|g" < "${NETDATA_MAKESELF_PATH}/makeself.lsm" > "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"
run "${NETDATA_MAKESELF_PATH}/makeself.sh" \ run "${NETDATA_MAKESELF_PATH}/makeself.sh" \
--gzip \ --gzip \
--complevel 9 \ --complevel 9 \
--notemp \ --notemp \
--needroot \ --needroot \
--target "${NETDATA_INSTALL_PATH}" \ --target "${NETDATA_INSTALL_PATH}" \
--header "${NETDATA_MAKESELF_PATH}/makeself-header.sh" \ --header "${NETDATA_MAKESELF_PATH}/makeself-header.sh" \
--lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" \ --lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" \
--license "${NETDATA_MAKESELF_PATH}/makeself-license.txt" \ --license "${NETDATA_MAKESELF_PATH}/makeself-license.txt" \
--help-header "${NETDATA_MAKESELF_PATH}/makeself-help-header.txt" \ --help-header "${NETDATA_MAKESELF_PATH}/makeself-help-header.txt" \
"${NETDATA_INSTALL_PATH}" \ "${NETDATA_INSTALL_PATH}" \
"${NETDATA_INSTALL_PATH}.gz.run" \ "${NETDATA_INSTALL_PATH}.gz.run" \
"netdata, the real-time performance and health monitoring system" \ "netdata, the real-time performance and health monitoring system" \
./system/post-installer.sh \ ./system/post-installer.sh
${NULL}
run rm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" run rm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"

View file

@ -1,12 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
set -e
LC_ALL=C LC_ALL=C
umask 002 umask 002
# be nice
renice 19 $$ >/dev/null 2>/dev/null
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# prepare the environment for the jobs # prepare the environment for the jobs
@ -14,10 +13,11 @@ renice 19 $$ >/dev/null 2>/dev/null
export NETDATA_INSTALL_PATH="${1-/opt/netdata}" export NETDATA_INSTALL_PATH="${1-/opt/netdata}"
# our source directory # our source directory
export NETDATA_MAKESELF_PATH="$(dirname "${0}")" NETDATA_MAKESELF_PATH="$(dirname "${0}")"
if [ "${NETDATA_MAKESELF_PATH:0:1}" != "/" ] export NETDATA_MAKESELF_PATH
then if [ "${NETDATA_MAKESELF_PATH:0:1}" != "/" ]; then
export NETDATA_MAKESELF_PATH="$(pwd)/${NETDATA_MAKESELF_PATH}" NETDATA_MAKESELF_PATH="$(pwd)/${NETDATA_MAKESELF_PATH}"
export NETDATA_MAKESELF_PATH
fi fi
# netdata source directory # netdata source directory
@ -30,12 +30,12 @@ export NULL=
cd "${NETDATA_MAKESELF_PATH}" || exit 1 cd "${NETDATA_MAKESELF_PATH}" || exit 1
# shellcheck source=packaging/makeself/functions.sh
. ./functions.sh "${@}" || exit 1 . ./functions.sh "${@}" || exit 1
for x in jobs/*.install.sh for x in jobs/*.install.sh; do
do progress "running ${x}"
progress "running ${x}" "${x}" "${NETDATA_INSTALL_PATH}"
"${x}" "${NETDATA_INSTALL_PATH}"
done done
echo >&2 "All jobs for static packaging done successfully." echo >&2 "All jobs for static packaging done successfully."