| 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::Copying archive files" || true |
| 9 | |
| 10 | VERSION="$("${NETDATA_INSTALL_PARENT}/netdata/bin/netdata" -v | cut -f 2 -d ' ')" |
| 11 | [ -z "${VERSION}" ] && VERSION="$(cat "${NETDATA_SOURCE_PATH}/packaging/version")" |
| 12 | |
| 13 | if [ "${VERSION}" == "" ]; then |
| 14 | echo >&2 "Cannot find version number. Create makeself executable from source code with git tree structure." |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | FILE="netdata-${BUILDARCH}-${VERSION}.gz.run" |
| 19 | |
| 20 | run mv "${NETDATA_INSTALL_PATH}.gz.run" "${NETDATA_SOURCE_PATH}/artifacts/${FILE}" |
| 21 | |
| 22 | [ -f "${NETDATA_SOURCE_PATH}/artifacts/netdata-${BUILDARCH}-latest.gz.run" ] && rm "${NETDATA_SOURCE_PATH}/artifacts/netdata-${BUILDARCH}-latest.gz.run" |
| 23 | run cp "${NETDATA_SOURCE_PATH}/artifacts/${FILE}" "${NETDATA_SOURCE_PATH}/artifacts/netdata-${BUILDARCH}-latest.gz.run" |
| 24 | |
| 25 | if [ "${BUILDARCH}" = "x86_64" ]; then |
| 26 | [ -f "${NETDATA_SOURCE_PATH}/artifacts/netdata-latest.gz.run" ] && rm "${NETDATA_SOURCE_PATH}/artifacts/netdata-latest.gz.run" |
| 27 | run cp "${NETDATA_SOURCE_PATH}/artifacts/${FILE}" "${NETDATA_SOURCE_PATH}/artifacts/netdata-latest.gz.run" |
| 28 | [ -f "${NETDATA_SOURCE_PATH}/artifacts/netdata-${VERSION}.gz.run" ] && rm "${NETDATA_SOURCE_PATH}/artifacts/netdata-${VERSION}.gz.run" |
| 29 | run cp "${NETDATA_SOURCE_PATH}/artifacts/${FILE}" "${NETDATA_SOURCE_PATH}/artifacts/netdata-${VERSION}.gz.run" |
| 30 | fi |
| 31 | |
| 32 | chown -R "$(stat -c '%u:%g' "${NETDATA_SOURCE_PATH}")" "${NETDATA_SOURCE_PATH}/artifacts" |
| 33 | |
| 34 | # shellcheck disable=SC2015 |
| 35 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true |