master
sh 46 lines 1.65 KB
Raw
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: GPL-3.0-or-later
3
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
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
12 # -----------------------------------------------------------------------------
13 # find the netdata version
14
15 VERSION="$("${NETDATA_INSTALL_PARENT}/netdata/bin/netdata" -v | cut -f 2 -d ' ')"
16 [ -z "${VERSION}" ] && VERSION="$(cat "${NETDATA_SOURCE_PATH}/packaging/version")"
17
18 if [ "${VERSION}" == "" ]; then
19 echo >&2 "Cannot find version number. Create makeself executable from source code with git tree structure."
20 exit 1
21 fi
22
23 # -----------------------------------------------------------------------------
24 # create the makeself archive
25
26 run sed "s|NETDATA_VERSION|${VERSION}|g" < "${NETDATA_MAKESELF_PATH}/makeself.lsm" > "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"
27
28 run "${NETDATA_MAKESELF_PATH}/makeself.sh" \
29 --gzip \
30 --complevel 9 \
31 --notemp \
32 --needroot \
33 --target "${NETDATA_INSTALL_PATH}" \
34 --header "${NETDATA_MAKESELF_PATH}/makeself-header.sh" \
35 --lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp" \
36 --license "${NETDATA_MAKESELF_PATH}/makeself-license.txt" \
37 --help-header "${NETDATA_MAKESELF_PATH}/makeself-help-header.txt" \
38 "${NETDATA_INSTALL_PATH}" \
39 "${NETDATA_INSTALL_PATH}.gz.run" \
40 "Netdata, X-Ray Vision for your infrastructure" \
41 ./system/post-installer.sh
42
43 run rm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"
44
45 # shellcheck disable=SC2015
46 [ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true