@cryptotaxi247 / netdata-1 / commits / 49b153430

Assorted cleanups to static builds. (#11798)

Austin S. Hemmelgarn committed Nov 17, 2021 at 14:01 UTC 49b15343052e475290d5feb70f88bd08fa490209
9 files changed +45 -24
packaging/makeself/build.sh
+5
@@ -39,6 +39,7 @@ if [ ! -f ../../netdata-installer.sh ]; then
39 fi
40
41 git clean -dxf
42 +git submodule foreach --recursive git clean -dxf
43
44 cat >&2 << EOF
45 This program will create a self-extracting shell package containing
@@ -55,6 +56,10 @@ else
56 rm -rf tmp/*
57 fi
58
59 +if [ -z "${GITHUB_ACTIONS}" ]; then
60 + export GITHUB_ACTIONS=false
61 +fi
62 +
63 if ! ./run-all-jobs.sh "$@"; then
64 printf >&2 "Build failed."
65 exit 1
packaging/makeself/jobs/10-prepare-destination.install.sh
+6 -4
@@ -4,18 +4,20 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Preparing build environment"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true
9
10 [ -d "${NETDATA_INSTALL_PATH}.old" ] && run rm -rf "${NETDATA_INSTALL_PATH}.old"
11 [ -d "${NETDATA_INSTALL_PATH}" ] && run mv -f "${NETDATA_INSTALL_PATH}" "${NETDATA_INSTALL_PATH}.old"
12
13 run mkdir -p "${NETDATA_INSTALL_PATH}/bin"
14 run mkdir -p "${NETDATA_INSTALL_PATH}/usr"
14 -run cd "${NETDATA_INSTALL_PATH}"
15 +run cd "${NETDATA_INSTALL_PATH}" || exit 1
16 run ln -s bin sbin
16 -run cd "${NETDATA_INSTALL_PATH}/usr"
17 +run cd "${NETDATA_INSTALL_PATH}/usr" || exit 1
18 run ln -s ../bin bin
19 run ln -s ../sbin sbin
20 run ln -s . local
21
21 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
22 +# shellcheck disable=SC2015
23 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
packaging/makeself/jobs/20-openssl.install.sh
+4 -2
@@ -4,7 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building OpenSSL"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building OpenSSL" || true
9
10 version="$(cat "$(dirname "${0}")/../openssl.version")"
11
@@ -22,4 +23,5 @@ run ./config -static no-tests --prefix=/openssl-static --openssldir=/opt/netdata
23 run make -j "$(nproc)"
24 run make -j "$(nproc)" install_sw
25
25 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
26 +# shellcheck disable=SC2015
27 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
packaging/makeself/jobs/50-bash-5.1.8.install.sh
+5 -3
@@ -4,7 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::building bash"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::building bash" || true
9
10 fetch "bash-5.1.8" "http://ftp.gnu.org/gnu/bash/bash-5.1.8.tar.gz" \
11 0cfb5c9bb1a29f800a97bd242d19511c997a1013815b805e0fdd32214113d6be
@@ -32,8 +33,9 @@ EOF
33
34 run make install
35
35 -if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
36 +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
37 run strip "${NETDATA_INSTALL_PATH}"/bin/bash
38 fi
39
39 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
40 +# shellcheck disable=SC2015
41 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
packaging/makeself/jobs/50-curl-7.78.0.install.sh
+5 -3
@@ -4,7 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building cURL"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building cURL" || true
9
10 fetch "curl-7.78.0" "https://curl.haxx.se/download/curl-7.78.0.tar.gz" \
11 ed936c0b02c06d42cf84b39dd12bb14b62d77c7c4e875ade022280df5dcc81d7
@@ -45,8 +46,9 @@ run make clean
46 run make -j "$(nproc)"
47 run make install
48
48 -if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
49 +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
50 run strip "${NETDATA_INSTALL_PATH}"/bin/curl
51 fi
52
52 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Preparing build environment"
53 +# shellcheck disable=SC2015
54 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true
packaging/makeself/jobs/50-fping-5.0.install.sh
+5 -3
@@ -4,7 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building fping"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building fping" || true
9
10 fetch "fping-5.0" "https://fping.org/dist/fping-5.0.tar.gz" \
11 ed38c0b9b64686a05d1b3bc1d66066114a492e04e44eef1821d43b1263cd57b8
@@ -28,8 +29,9 @@ run make clean
29 run make -j "$(nproc)"
30 run make install
31
31 -if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
32 +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
33 run strip "${NETDATA_INSTALL_PATH}"/bin/fping
34 fi
35
35 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
36 +# shellcheck disable=SC2015
37 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
packaging/makeself/jobs/50-ioping-1.2.install.sh
+5 -3
@@ -4,7 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building ioping"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building ioping" || true
9
10 fetch "ioping-1.2" "https://github.com/koct9i/ioping/archive/v1.2.tar.gz" \
11 d3e4497c653a1e96df67c72ce2b70da18e9f5e3b93179a5bb57a6e30ceacfa75
@@ -16,8 +17,9 @@ run make -j "$(nproc)"
17 run mkdir -p "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/
18 run install -o root -g root -m 4750 ioping "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/
19
19 -if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
20 +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
21 run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ioping
22 fi
23
23 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
24 +# shellcheck disable=SC2015
25 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
packaging/makeself/jobs/70-netdata-git.install.sh
+6 -4
@@ -6,7 +6,7 @@
6
7 cd "${NETDATA_SOURCE_PATH}" || exit 1
8
9 -if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
9 +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
10 export CFLAGS="-static -O3 -I/openssl-static/include"
11 else
12 export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include"
@@ -34,7 +34,8 @@ run ./netdata-installer.sh \
34 --use-system-protobuf \
35 --dont-scrub-cflags-even-though-it-may-break-things
36
37 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Finishing netdata install"
37 +# shellcheck disable=SC2015
38 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Finishing netdata install" || true
39
40 # Properly mark the install type
41 cat > "${NETDATA_INSTALL_PATH}/etc/netdata/.install-type" <<-EOF
@@ -52,10 +53,11 @@ if run readelf -l "${NETDATA_INSTALL_PATH}"/bin/netdata | grep 'INTERP'; then
53 exit 1
54 fi
55
55 -if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
56 +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
57 run strip "${NETDATA_INSTALL_PATH}"/bin/netdata
58 run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/apps.plugin
59 run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/cgroup-network
60 fi
61
61 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
62 +# shellcheck disable=SC2015
63 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
packaging/makeself/jobs/99-makeself.install.sh
+4 -2
@@ -4,7 +4,8 @@
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7 -[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Building self-extracting archive"
7 +# shellcheck disable=SC2015
8 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building self-extracting archive" || true
9
10 run cd "${NETDATA_SOURCE_PATH}" || exit 1
11
@@ -107,6 +108,7 @@ if [ "${BUILDARCH}" = "x86_64" ]; then
108 run ln -s "./${FILE}" "artifacts/netdata-${VERSION}.gz.run"
109 fi
110
110 -[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
111 +# shellcheck disable=SC2015
112 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
113
114 echo >&2 "Self-extracting installer moved to 'artifacts/${FILE}'"