| 1 | #!/bin/bash |
| 2 | |
| 3 | repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")" |
| 4 | |
| 5 | # shellcheck source=./win-build-dir.sh |
| 6 | . "${repo_root}/packaging/windows/win-build-dir.sh" |
| 7 | |
| 8 | set -eu -o pipefail |
| 9 | |
| 10 | # Regenerate keys everytime there is an update |
| 11 | if [ -d /opt/netdata/etc/pki/ ]; then |
| 12 | rm -rf /opt/netdata/etc/pki/ |
| 13 | fi |
| 14 | |
| 15 | # Remove previous installation of msys2 script |
| 16 | if [ -f /opt/netdata/usr/bin/bashbug ]; then |
| 17 | rm -rf /opt/netdata/usr/bin/bashbug |
| 18 | fi |
| 19 | |
| 20 | ${GITHUB_ACTIONS+echo "::group::Installing"} |
| 21 | cmake --install "${build}" |
| 22 | ${GITHUB_ACTIONS+echo "::endgroup::"} |
| 23 | |
| 24 | if [ ! -f "/msys2-latest.tar.zst" ]; then |
| 25 | ${GITHUB_ACTIONS+echo "::group::Fetching MSYS2 files"} |
| 26 | "${repo_root}/packaging/windows/fetch-msys2-installer.py" /msys2-latest.tar.zst |
| 27 | ${GITHUB_ACTIONS+echo "::endgroup::"} |
| 28 | fi |
| 29 | |
| 30 | ${GITHUB_ACTIONS+echo "::group::Licenses"} |
| 31 | if [ ! -f "/gpl-3.0.txt" ]; then |
| 32 | cp "${repo_root}/LICENSE" /gpl-3.0.txt |
| 33 | fi |
| 34 | |
| 35 | if [ ! -f "/cloud.txt" ]; then |
| 36 | curl -o /cloud.txt "https://app.netdata.cloud/LICENSE.txt" |
| 37 | fi |
| 38 | ${GITHUB_ACTIONS+echo "::endgroup::"} |
| 39 | |
| 40 | ${GITHUB_ACTIONS+echo "::group::Copy Files"} |
| 41 | tar -xf /msys2-latest.tar.zst -C /opt/netdata/ || exit 1 |
| 42 | cp -R /opt/netdata/msys64/* /opt/netdata/ || exit 1 |
| 43 | cp packaging/windows/copy_files.ps1 /opt/netdata/usr/libexec/netdata/ || exit 1 |
| 44 | rm -rf /opt/netdata/msys64/ |
| 45 | ${GITHUB_ACTIONS+echo "::endgroup::"} |
| 46 | |
| 47 | ${GITHUB_ACTIONS+echo "::group::Configure Editor"} |
| 48 | if [ -f "/opt/netdata/etc/profile" ]; then |
| 49 | echo 'EDITOR="/usr/bin/nano.exe"' >> /opt/netdata/etc/profile |
| 50 | fi |
| 51 | ${GITHUB_ACTIONS+echo "::endgroup::"} |
| 52 | |
| 53 | # TODO: We will have a PR to adjust CAB file creation and sign. This is only adding necessary structure |
| 54 | #${GITHUB_ACTIONS+echo "::group::CAB file"} |
| 55 | #mkdir "${build}/driver" |
| 56 | #cp "${build}/usr/bin/netdata_driver.*" "${build}/driver" |
| 57 | #powershell.exe -ExecutionPolicy Bypass -File "${repo_root}/packaging/windows/generate-driver-catalog.ps1" |
| 58 | #${GITHUB_ACTIONS+echo "::endgroup::"} |