diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:35 +0000 |
commit | f09848204fa5283d21ea43e262ee41aa578e1808 (patch) | |
tree | c62385d7adf209fa6a798635954d887f718fb3fb /packaging/installer | |
parent | Releasing debian version 1.46.3-2. (diff) | |
download | netdata-f09848204fa5283d21ea43e262ee41aa578e1808.tar.xz netdata-f09848204fa5283d21ea43e262ee41aa578e1808.zip |
Merging upstream version 1.47.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer')
-rwxr-xr-x | packaging/installer/dependencies/alpine.sh | 30 | ||||
-rwxr-xr-x | packaging/installer/dependencies/arch.sh | 31 | ||||
-rwxr-xr-x | packaging/installer/dependencies/centos.sh | 7 | ||||
-rwxr-xr-x | packaging/installer/dependencies/debian.sh | 8 | ||||
-rwxr-xr-x | packaging/installer/dependencies/fedora.sh | 14 | ||||
-rwxr-xr-x | packaging/installer/dependencies/freebsd.sh | 19 | ||||
-rwxr-xr-x | packaging/installer/dependencies/gentoo.sh | 34 | ||||
-rwxr-xr-x | packaging/installer/dependencies/ol.sh | 7 | ||||
-rwxr-xr-x | packaging/installer/dependencies/opensuse.sh | 7 | ||||
-rwxr-xr-x | packaging/installer/dependencies/rockylinux.sh | 7 | ||||
-rwxr-xr-x | packaging/installer/dependencies/ubuntu.sh | 7 | ||||
-rw-r--r-- | packaging/installer/functions.sh | 2 | ||||
-rwxr-xr-x | packaging/installer/install-required-packages.sh | 82 | ||||
-rw-r--r-- | packaging/installer/installer.nsi | 128 | ||||
-rwxr-xr-x | packaging/installer/kickstart.sh | 69 | ||||
-rwxr-xr-x | packaging/installer/package-windows.sh | 43 |
16 files changed, 264 insertions, 231 deletions
diff --git a/packaging/installer/dependencies/alpine.sh b/packaging/installer/dependencies/alpine.sh index 88d63c8a7..77a6fc828 100755 --- a/packaging/installer/dependencies/alpine.sh +++ b/packaging/installer/dependencies/alpine.sh @@ -9,33 +9,27 @@ DONT_WAIT=0 package_tree=" alpine-sdk - coreutils - git - gcc - g++ - automake - autoconf cmake - make - libatomic - libtool - pkgconfig - tar + coreutils curl + elfutils-dev + g++ + gcc + git gzip + json-c-dev + libatomic + libmnl-dev libuv-dev lz4-dev + make openssl-dev - elfutils-dev + pkgconfig python3 - zlib-dev + tar util-linux-dev - libmnl-dev - json-c-dev - musl-fts-dev - bison - flex yaml-dev + zlib-dev " usage() { diff --git a/packaging/installer/dependencies/arch.sh b/packaging/installer/dependencies/arch.sh index 30be834be..7b0c9c54f 100755 --- a/packaging/installer/dependencies/arch.sh +++ b/packaging/installer/dependencies/arch.sh @@ -8,32 +8,25 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - gcc - make - autoconf - autoconf-archive - autogen - automake - libtool + binutils cmake - zlib - util-linux - libmnl + curl + gcc + git + gzip json-c - libyaml + libelf + libmnl libuv + libyaml lz4 + make openssl - libelf - git pkgconfig - tar - curl - gzip python3 - binutils - bison - flex + tar + util-linux + zlib ) usage() { diff --git a/packaging/installer/dependencies/centos.sh b/packaging/installer/dependencies/centos.sh index 532a0a71e..b647b2304 100755 --- a/packaging/installer/dependencies/centos.sh +++ b/packaging/installer/dependencies/centos.sh @@ -5,15 +5,9 @@ set -e declare -a package_tree=( - autoconf - autoconf-archive - automake - bison cmake - cmake3 curl elfutils-libelf-devel - flex findutils gcc gcc-c++ @@ -22,7 +16,6 @@ declare -a package_tree=( json-c-devel libatomic libmnl-devel - libtool libuuid-devel libuv-devel libyaml-devel diff --git a/packaging/installer/dependencies/debian.sh b/packaging/installer/dependencies/debian.sh index 692a71191..099963afe 100755 --- a/packaging/installer/dependencies/debian.sh +++ b/packaging/installer/dependencies/debian.sh @@ -8,14 +8,8 @@ NON_INTERACTIVE=0 DONT_WAIT=0 package_tree=" - autoconf - autoconf-archive - autogen - automake - bison cmake curl - flex g++ gcc git @@ -27,12 +21,10 @@ package_tree=" libmnl-dev libssl-dev libsystemd-dev - libtool libuv1-dev libyaml-dev make pkg-config - python python3 tar uuid-dev diff --git a/packaging/installer/dependencies/fedora.sh b/packaging/installer/dependencies/fedora.sh index fc30b6113..151746377 100755 --- a/packaging/installer/dependencies/fedora.sh +++ b/packaging/installer/dependencies/fedora.sh @@ -17,23 +17,11 @@ os_version() { fi } -if [[ $(os_version) -gt 24 ]]; then - ulogd_pkg= -else - ulogd_pkg=ulogd -fi - declare -a package_tree=( - autoconf - autoconf-archive - autogen - automake - bison cmake curl elfutils-libelf-devel findutils - flex gcc gcc-c++ git @@ -41,7 +29,6 @@ declare -a package_tree=( json-c-devel libatomic libmnl-devel - libtool libuuid-devel libuv-devel libyaml-devel @@ -53,7 +40,6 @@ declare -a package_tree=( systemd-devel tar zlib-devel - "${ulogd_pkg}" ) usage() { diff --git a/packaging/installer/dependencies/freebsd.sh b/packaging/installer/dependencies/freebsd.sh index eadbcfa98..91fd2959c 100755 --- a/packaging/installer/dependencies/freebsd.sh +++ b/packaging/installer/dependencies/freebsd.sh @@ -8,26 +8,19 @@ NON_INTERACTIVE=0 DONT_WAIT=0 package_tree=" - git - autoconf - autoconf-archive - autogen - automake - libtool - pkgconf cmake curl - gzip - lzlib e2fsprogs-libuuid + git + gzip json-c - libyaml - libuv liblz4 + libuv + libyaml + lzlib openssl + pkgconf python3 - bison - flex " prompt() { diff --git a/packaging/installer/dependencies/gentoo.sh b/packaging/installer/dependencies/gentoo.sh index 9cf7f281a..58e805a2d 100755 --- a/packaging/installer/dependencies/gentoo.sh +++ b/packaging/installer/dependencies/gentoo.sh @@ -8,32 +8,26 @@ NON_INTERACTIVE=0 DONT_WAIT=0 package_tree=" + app-alternatives/gzip + app-alternatives/tar + app-arch/lz4 + dev-lang/python + dev-libs/json-c + dev-libs/libuv + dev-libs/libyaml + dev-libs/openssl + dev-util/cmake dev-vcs/git + net-libs/libmnl + net-misc/curl sys-apps/findutils + sys-apps/util-linux sys-devel/gcc sys-devel/make - sys-devel/autoconf - sys-devel/autoconf-archive - sys-devel/autogen - sys-devel/automake - virtual/pkgconfig - dev-util/cmake - app-arch/tar - net-misc/curl - app-arch/gzip - sys-apps/util-linux - net-libs/libmnl - dev-libs/json-c - dev-libs/libyaml - dev-libs/libuv - app-arch/lz4 - dev-libs/openssl virtual/libelf - dev-lang/python - dev-libs/libuv - sys-devel/bison - sys-devel/flex + virtual/pkgconfig " + usage() { cat << EOF OPTIONS: diff --git a/packaging/installer/dependencies/ol.sh b/packaging/installer/dependencies/ol.sh index 2dc10cee5..fca904a9b 100755 --- a/packaging/installer/dependencies/ol.sh +++ b/packaging/installer/dependencies/ol.sh @@ -8,15 +8,9 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - autoconf - autoconf-archive - autogen - automake - bison cmake curl elfutils-libelf-devel - flex gcc gcc-c++ git @@ -24,7 +18,6 @@ declare -a package_tree=( json-c-devel libatomic libmnl-devel - libtool libuuid-devel libuv-devel libyaml-devel diff --git a/packaging/installer/dependencies/opensuse.sh b/packaging/installer/dependencies/opensuse.sh index ecf1268fc..4fba64095 100755 --- a/packaging/installer/dependencies/opensuse.sh +++ b/packaging/installer/dependencies/opensuse.sh @@ -10,14 +10,8 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - autoconf - autoconf-archive - autogen - automake - bison cmake curl - flex gcc gcc-c++ git @@ -28,7 +22,6 @@ declare -a package_tree=( liblz4-devel libmnl-devel libopenssl-devel - libtool libuuid-devel libuv-devel libyaml-devel diff --git a/packaging/installer/dependencies/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh index cc8d45204..921fd29bf 100755 --- a/packaging/installer/dependencies/rockylinux.sh +++ b/packaging/installer/dependencies/rockylinux.sh @@ -8,16 +8,10 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - autoconf - autoconf-archive - autogen - automake - bison cmake curl elfutils-libelf-devel findutils - flex gcc gcc-c++ git @@ -25,7 +19,6 @@ declare -a package_tree=( json-c-devel libatomic libmnl-devel - libtool libuuid-devel libuv-devel libyaml-devel diff --git a/packaging/installer/dependencies/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh index e223ca384..c6e5a0b36 100755 --- a/packaging/installer/dependencies/ubuntu.sh +++ b/packaging/installer/dependencies/ubuntu.sh @@ -8,14 +8,8 @@ NON_INTERACTIVE=0 DONT_WAIT=0 package_tree=" - autoconf - autoconf-archive - autogen - automake - bison cmake curl - flex g++ gcc git @@ -27,7 +21,6 @@ package_tree=" libmnl-dev libssl-dev libsystemd-dev - libtool libuv1-dev libyaml-dev make diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index 6143eedb4..c339ac87c 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -340,8 +340,6 @@ prepare_cmake_options() { enable_feature PLUGIN_LOCAL_LISTENERS "${IS_LINUX}" enable_feature PLUGIN_NETWORK_VIEWER "${IS_LINUX}" enable_feature PLUGIN_EBPF "${ENABLE_EBPF:-0}" - enable_feature PLUGIN_LOGS_MANAGEMENT "${ENABLE_LOGS_MANAGEMENT:-0}" - enable_feature LOGS_MANAGEMENT_TESTS "${ENABLE_LOGS_MANAGEMENT_TESTS:-0}" enable_feature ACLK "${ENABLE_CLOUD:-1}" enable_feature CLOUD "${ENABLE_CLOUD:-1}" diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh index 96bc4aee7..e97902026 100755 --- a/packaging/installer/install-required-packages.sh +++ b/packaging/installer/install-required-packages.sh @@ -632,74 +632,12 @@ declare -A pkg_coreutils=( ['default']="NOTREQUIRED" ) -declare -A pkg_autoconf=( - ['gentoo']="sys-devel/autoconf" - ['clearlinux']="c-basic" - ['default']="autoconf" -) - -# required to compile netdata with --enable-sse -# https://github.com/firehol/netdata/pull/450 -declare -A pkg_autoconf_archive=( - ['gentoo']="sys-devel/autoconf-archive" - ['clearlinux']="c-basic" - ['alpine']="WARNING|" - ['default']="autoconf-archive" - - # exceptions - ['centos-6']="WARNING|" - ['rhel-6']="WARNING|" - ['rhel-7']="WARNING|" -) - -declare -A pkg_autogen=( - ['gentoo']="sys-devel/autogen" - ['clearlinux']="c-basic" - ['alpine']="WARNING|" - ['default']="autogen" - - # exceptions - ['centos-6']="WARNING|" - ['rhel-6']="WARNING|" - ['centos-9']="NOTREQUIRED|" - ['rhel-9']="NOTREQUIRED|" -) - -declare -A pkg_automake=( - ['gentoo']="sys-devel/automake" - ['clearlinux']="c-basic" - ['default']="automake" -) - -# Required to build libwebsockets and libmosquitto on some systems. declare -A pkg_cmake=( ['gentoo']="dev-util/cmake" ['clearlinux']="c-basic" ['default']="cmake" ) -# bison and flex are required by Fluent-Bit -declare -A pkg_bison=( - ['default']="bison" -) - -declare -A pkg_flex=( - ['default']="flex" -) - -# fts-dev is required by Fluent-Bit on Alpine -declare -A pkg_fts_dev=( - ['default']="NOTREQUIRED" - ['alpine']="musl-fts-dev" - ['alpine-3.16.9']="fts-dev" -) - -# cmake3 is required by Fluent-Bit on CentOS 7 -declare -A pkg_cmake3=( - ['default']="NOTREQUIRED" - ['centos-7']="cmake3" -) - declare -A pkg_json_c_dev=( ['alpine']="json-c-dev" ['arch']="json-c" @@ -772,13 +710,13 @@ declare -A pkg_curl=( ) declare -A pkg_gzip=( - ['gentoo']="app-arch/gzip" + ['gentoo']="app-alternatives/gzip" ['macos']="NOTREQUIRED" ['default']="gzip" ) declare -A pkg_tar=( - ['gentoo']="app-arch/tar" + ['gentoo']="app-alternatives/tar" ['clearlinux']="os-core-update" ['macos']="NOTREQUIRED" ['freebsd']="NOTREQUIRED" @@ -1249,14 +1187,9 @@ packages() { require_cmd gcc-multilib || suitable_package gcc require_cmd g++ || require_cmd clang++ || suitable_package gxx - require_cmd make || suitable_package make - require_cmd autoconf || suitable_package autoconf - suitable_package autoconf-archive - require_cmd autogen || suitable_package autogen - require_cmd automake || suitable_package automake require_cmd pkg-config || suitable_package pkg-config require_cmd cmake || suitable_package cmake - require_cmd cmake3 || suitable_package cmake3 + require_cmd make || suitable_package make # ------------------------------------------------------------------------- # debugging tools for development @@ -1279,8 +1212,6 @@ packages() { require_cmd tar || suitable_package tar require_cmd curl || suitable_package curl require_cmd gzip || suitable_package gzip - require_cmd bison || suitable_package bison - require_cmd flex || suitable_package flex fi # ------------------------------------------------------------------------- @@ -1312,7 +1243,6 @@ packages() { suitable_package libuuid-dev suitable_package libmnl-dev suitable_package json-c-dev - suitable_package fts-dev suitable_package libyaml-dev suitable_package libsystemd-dev suitable_package pcre2 @@ -1348,9 +1278,6 @@ packages() { if [ "${PACKAGES_NETDATA_PYTHON}" -ne 0 ]; then require_cmd python || suitable_package python - - # suitable_package python-requests - # suitable_package python-pip fi # ------------------------------------------------------------------------- @@ -1358,9 +1285,6 @@ packages() { if [ "${PACKAGES_NETDATA_PYTHON3}" -ne 0 ]; then require_cmd python3 || suitable_package python3 - - # suitable_package python3-requests - # suitable_package python3-pip fi # ------------------------------------------------------------------------- diff --git a/packaging/installer/installer.nsi b/packaging/installer/installer.nsi new file mode 100644 index 000000000..c14ccb599 --- /dev/null +++ b/packaging/installer/installer.nsi @@ -0,0 +1,128 @@ +!include "MUI2.nsh" +!include "nsDialogs.nsh" +!include "FileFunc.nsh" + +Name "Netdata" +Outfile "netdata-installer.exe" +InstallDir "$PROGRAMFILES\Netdata" +RequestExecutionLevel admin + +!define MUI_ICON "NetdataWhite.ico" +!define MUI_UNICON "NetdataWhite.ico" + +!define ND_UININSTALL_REG "Software\Microsoft\Windows\CurrentVersion\Uninstall\Netdata" + +!define MUI_ABORTWARNING +!define MUI_UNABORTWARNING + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "C:\msys64\gpl-3.0.txt" +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" + +Function .onInit + nsExec::ExecToLog '$SYSDIR\sc.exe stop Netdata' + pop $0 + ${If} $0 == 0 + nsExec::ExecToLog '$SYSDIR\sc.exe delete Netdata' + pop $0 + ${EndIf} +FunctionEnd + +Function NetdataUninstallRegistry + ClearErrors + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "DisplayName" "Netdata - Real-time system monitoring." + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "DisplayIcon" "$INSTDIR\Uninstall.exe,0" + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "UninstallString" "$INSTDIR\Uninstall.exe" + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "RegOwner" "Netdata Inc." + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "RegCompany" "Netdata Inc." + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "Publisher" "Netdata Inc." + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "HelpLink" "https://learn.netdata.cloud/" + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "URLInfoAbout" "https://www.netdata.cloud/" + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "DisplayVersion" "${CURRVERSION}" + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "VersionMajor" "${MAJORVERSION}" + WriteRegStr HKLM "${ND_UININSTALL_REG}" \ + "VersionMinor" "${MINORVERSION}" + + IfErrors 0 +2 + MessageBox MB_ICONEXCLAMATION|MB_OK "Unable to create an entry in the Control Panel!" IDOK end + + ClearErrors + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 + WriteRegDWORD HKLM "${ND_UININSTALL_REG}" "EstimatedSize" "$0" + + IfErrors 0 +2 + MessageBox MB_ICONEXCLAMATION|MB_OK "Cannot estimate the installation size." IDOK end + end: +FunctionEnd + +Section "Install Netdata" + SetOutPath $INSTDIR + SetCompress off + + File /r "C:\msys64\opt\netdata\*.*" + + ClearErrors + nsExec::ExecToLog '$SYSDIR\sc.exe create Netdata binPath= "$INSTDIR\usr\bin\netdata.exe" start= delayed-auto' + pop $0 + ${If} $0 != 0 + DetailPrint "Warning: Failed to create Netdata service." + ${EndIf} + + ClearErrors + nsExec::ExecToLog '$SYSDIR\sc.exe description Netdata "Real-time system monitoring service"' + pop $0 + ${If} $0 != 0 + DetailPrint "Warning: Failed to add Netdata service description." + ${EndIf} + + ClearErrors + nsExec::ExecToLog '$SYSDIR\sc.exe start Netdata' + pop $0 + ${If} $0 != 0 + DetailPrint "Warning: Failed to start Netdata service." + ${EndIf} + + WriteUninstaller "$INSTDIR\Uninstall.exe" + + Call NetdataUninstallRegistry +SectionEnd + +Section "Uninstall" + ClearErrors + nsExec::ExecToLog '$SYSDIR\sc.exe stop Netdata' + pop $0 + ${If} $0 != 0 + DetailPrint "Warning: Failed to stop Netdata service." + ${EndIf} + + ClearErrors + nsExec::ExecToLog '$SYSDIR\sc.exe delete Netdata' + pop $0 + ${If} $0 != 0 + DetailPrint "Warning: Failed to delete Netdata service." + ${EndIf} + + RMDir /r "$INSTDIR" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Netdata" +SectionEnd + diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index dde738c28..72b82be26 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later # -# Next unused error code: F051A +# Next unused error code: F051B # ====================================================================== # Constants @@ -21,8 +21,8 @@ KICKSTART_SOURCE="$( )" DEFAULT_PLUGIN_PACKAGES="" PATH="${PATH}:/usr/local/bin:/usr/local/sbin" -REPOCONFIG_DEB_VERSION="2-2" -REPOCONFIG_RPM_VERSION="2-2" +REPOCONFIG_DEB_VERSION="3-2" +REPOCONFIG_RPM_VERSION="3-2" START_TIME="$(date +%s)" STATIC_INSTALL_ARCHES="x86_64 armv7l armv6l aarch64 ppc64le" @@ -378,12 +378,14 @@ trap 'trap_handler 15 0' TERM # Utility functions canonical_path() { + OLDPWD="$(pwd)" cd "$(dirname "${1}")" || exit 1 case "$(basename "${1}")" in ..) dirname "$(pwd -P)" ;; .) pwd -P ;; *) echo "$(pwd -P)/$(basename "${1}")" ;; esac + cd "${OLDPWD}" || exit 1 } setup_terminal() { @@ -453,7 +455,7 @@ deferred_warnings() { fatal() { deferred_warnings - printf >&2 "%s\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${1}" + printf >&2 "%b\n\n" "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${1}" printf >&2 "%s\n" "For community support, you can connect with us on:" support_list telemetry_event "INSTALL_FAILED" "${1}" "${2}" @@ -741,8 +743,6 @@ get_redirect() { } safe_sha256sum() { - # Within the context of the installer, we only use -c option that is common between the two commands - # We will have to reconsider if we start using non-common options if command -v shasum > /dev/null 2>&1; then shasum -a 256 "$@" elif command -v sha256sum > /dev/null 2>&1; then @@ -752,6 +752,17 @@ safe_sha256sum() { fi } +report_bad_sha256sum() { + file="${1}" + sums="${2}" + + actual="$(safe_sha256sum "${file}" | awk '{ print $1 }')" + expected="$(grep "${file}" "${sums}" | awk '{ print $1 }')" + + printf "Expected: %s\n" "${expected}" + printf "Actual: %s\n" "${actual}" +} + get_system_info() { SYSARCH="$(uname -m)" @@ -1371,7 +1382,7 @@ set_auto_updates() { if [ "${DRY_RUN}" -eq 1 ]; then progress "Would have attempted to enable automatic updates." # This first case is for catching using a new kickstart script with an old build. It can be safely removed after v1.34.0 is released. - elif ! run_as_root grep -q '\-\-enable-auto-updates' "${updater}"; then + elif ! run_as_root grep -q '\--enable-auto-updates' "${updater}"; then echo elif ! run_as_root "${updater}" --enable-auto-updates "${NETDATA_AUTO_UPDATE_TYPE}"; then warning "Failed to enable auto updates. Netdata will still work, but you will need to update manually." @@ -1794,11 +1805,11 @@ try_static_install() { return 2 fi - if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "${tmpdir}/${netdata_agent}"; then + if ! download "${NETDATA_STATIC_ARCHIVE_URL}" "./${netdata_agent}"; then fatal "Unable to download static build archive for ${SYSARCH}. ${BADNET_MSG}." F0208 fi - if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then + if ! download "${NETDATA_STATIC_ARCHIVE_CHECKSUM_URL}" "./sha256sum.txt"; then fatal "Unable to fetch checksums to verify static build archive. ${BADNET_MSG}." F0206 fi @@ -1806,8 +1817,9 @@ try_static_install() { progress "Would validate SHA256 checksum of downloaded static build archive." else if [ -z "${INSTALL_VERSION}" ]; then - if ! grep "${netdata_agent}" "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then - fatal "Static binary checksum validation failed. ${BADCACHE_MSG}." F0207 + if ! grep "${netdata_agent}" ./sha256sum.txt | safe_sha256sum -c - > /dev/null 2>&1; then + bad_sums_report="$(report_bad_sha256sum "${netdata_agent}" "./sha256sum.txt")" + fatal "Static binary checksum validation failed.\n${bad_sums_report}\n${BADCACHE_MSG}." F0207 fi fi fi @@ -1824,7 +1836,7 @@ try_static_install() { progress "Installing netdata" # shellcheck disable=SC2086 - if ! run_as_root ${env_cmd} /bin/sh "${tmpdir}/${netdata_agent}" ${opts} -- ${NETDATA_INSTALLER_OPTIONS}; then + if ! run_as_root ${env_cmd} /bin/sh "./${netdata_agent}" ${opts} -- ${NETDATA_INSTALLER_OPTIONS}; then warning "Failed to install static build of Netdata on ${SYSARCH}." run rm -rf /opt/netdata return 2 @@ -1936,6 +1948,7 @@ build_and_install() { run_script ./netdata-installer.sh ${opts} case $? in + 0) ;; 1) if [ -n "${EXIT_REASON}" ]; then fatal "netdata-installer.sh failed to run: ${EXIT_REASON}" "${EXIT_CODE}" @@ -1944,6 +1957,7 @@ build_and_install() { fi ;; 2) fatal "Insufficient RAM to install netdata." F0008 ;; + *) fatal "netdata-installer.sh failed to run: Encountered an unhandled error in the installer code." F051A ;; esac } @@ -1963,14 +1977,14 @@ try_build_install() { set_source_archive_urls "${SELECTED_RELEASE_CHANNEL}" if [ -n "${INSTALL_VERSION}" ]; then - if ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-v${INSTALL_VERSION}.tar.gz"; then + if ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "./netdata-v${INSTALL_VERSION}.tar.gz"; then fatal "Failed to download source tarball for local build. ${BADNET_MSG}." F000B fi - elif ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "${tmpdir}/netdata-latest.tar.gz"; then + elif ! download "${NETDATA_SOURCE_ARCHIVE_URL}" "./netdata-latest.tar.gz"; then fatal "Failed to download source tarball for local build. ${BADNET_MSG}." F000B fi - if ! download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "${tmpdir}/sha256sum.txt"; then + if ! download "${NETDATA_SOURCE_ARCHIVE_CHECKSUM_URL}" "./sha256sum.txt"; then fatal "Failed to download checksums for source tarball verification. ${BADNET_MSG}." F000C fi @@ -1979,18 +1993,19 @@ try_build_install() { else if [ -z "${INSTALL_VERSION}" ]; then # shellcheck disable=SC2086 - if ! grep netdata-latest.tar.gz "${tmpdir}/sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then - fatal "Tarball checksum validation failed. ${BADCACHE_MSG}." F0005 + if ! grep netdata-latest.tar.gz "./sha256sum.txt" | safe_sha256sum -c - > /dev/null 2>&1; then + bad_sums_report="$(report_bad_sha256sum netdata-latest.tar.gz "./sha256sum.txt")" + fatal "Tarball checksum validation failed.\n${bad_sums_report}\n${BADCACHE_MSG}." F0005 fi fi fi if [ -n "${INSTALL_VERSION}" ]; then - run tar -xf "${tmpdir}/netdata-v${INSTALL_VERSION}.tar.gz" -C "${tmpdir}" - rm -rf "${tmpdir}/netdata-v${INSTALL_VERSION}.tar.gz" > /dev/null 2>&1 + run tar -xf "./netdata-v${INSTALL_VERSION}.tar.gz" -C "${tmpdir}" + rm -rf "./netdata-v${INSTALL_VERSION}.tar.gz" > /dev/null 2>&1 else - run tar -xf "${tmpdir}/netdata-latest.tar.gz" -C "${tmpdir}" - rm -rf "${tmpdir}/netdata-latest.tar.gz" > /dev/null 2>&1 + run tar -xf "./netdata-latest.tar.gz" -C "${tmpdir}" + rm -rf "./netdata-latest.tar.gz" > /dev/null 2>&1 fi if [ "${DRY_RUN}" -ne 1 ]; then @@ -2073,8 +2088,16 @@ prepare_offline_install_source() { if [ "${DRY_RUN}" -ne 1 ]; then progress "Verifying checksums." - if ! grep -e "$(find . -name '*.gz.run')" sha256sums.txt | safe_sha256sum -c -; then - fatal "Checksums for offline install files are incorrect. ${BADCACHE_MSG}." F0507 + + failed_files="" + for file in $(find . -name '*.gz.run'); do + if ! grep -e "${file}" sha256sums.txt | safe_sha256sum -c -; then + failed_files="${failed_files}\n${file}\n$(report_bad_sha256sums "${file}" sha256sums.txt)" + fi + done + + if [ -n "${failed_files}" ]; then + fatal "Checksums for offline install files are incorrect.\n${failed_files}\n${BADCACHE_MSG}." F0507 fi else progress "Would verify SHA256 checksums of downloaded installation files." diff --git a/packaging/installer/package-windows.sh b/packaging/installer/package-windows.sh new file mode 100755 index 000000000..7b1c57e46 --- /dev/null +++ b/packaging/installer/package-windows.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")" + +if [ -n "${BUILD_DIR}" ]; then + build="${BUILD_DIR}" +elif [ -n "${OSTYPE}" ]; then + if [ -n "${MSYSTEM}" ]; then + build="${repo_root}/build-${OSTYPE}-${MSYSTEM}" + else + build="${repo_root}/build-${OSTYPE}" + fi +elif [ "$USER" = "vk" ]; then + build="${repo_root}/build" +else + build="${repo_root}/build" +fi + +set -exu -o pipefail + +${GITHUB_ACTIONS+echo "::group::Installing"} +cmake --install "${build}" +${GITHUB_ACTIONS+echo "::endgroup::"} + +if [ ! -f "/msys2-installer.exe" ]; then + ${GITHUB_ACTIONS+echo "::group::Fetching MSYS2 installer"} + "${repo_root}/packaging/windows/fetch-msys2-installer.py" /msys2-installer.exe + ${GITHUB_ACTIONS+echo "::endgroup::"} +fi + +${GITHUB_ACTIONS+echo "::group::Packaging"} +NDVERSION=$"$(grep 'CMAKE_PROJECT_VERSION:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)" +NDMAJORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MAJOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)" +NDMINORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MINOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)" + +if [ -f "/gpl-3.0.txt" ]; then + ${GITHUB_ACTIONS+echo "::group::Fetching GPL3 License"} + curl -o /gpl-3.0.txt "https://www.gnu.org/licenses/gpl-3.0.txt" + ${GITHUB_ACTIONS+echo "::endgroup::"} +fi + +/mingw64/bin/makensis.exe -DCURRVERSION="${NDVERSION}" -DMAJORVERSION="${NDMAJORVERSION}" -DMINORVERSION="${NDMINORVERSION}" "${repo_root}/packaging/windows/installer.nsi" +${GITHUB_ACTIONS+echo "::endgroup::"} |