From a2d7dede737947d7c6afa20a88e1f0c64e0eb96c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 10 Aug 2023 11:18:52 +0200 Subject: Merging upstream version 1.42.0. Signed-off-by: Daniel Baumann --- packaging/installer/README.md | 12 ++--- packaging/installer/UPDATE.md | 3 ++ packaging/installer/dependencies/centos.sh | 27 +++++------ packaging/installer/dependencies/clearlinux.sh | 19 ++++---- packaging/installer/dependencies/debian.sh | 31 +++++++------ packaging/installer/dependencies/fedora.sh | 29 ++++++------ packaging/installer/dependencies/ol.sh | 29 ++++++------ packaging/installer/dependencies/opensuse.sh | 33 ++++++------- packaging/installer/dependencies/rockylinux.sh | 27 +++++------ packaging/installer/dependencies/ubuntu.sh | 33 ++++++------- packaging/installer/install-required-packages.sh | 14 ++++++ packaging/installer/kickstart.sh | 52 +++++++++++++-------- packaging/installer/methods/kickstart.md | 4 +- packaging/installer/methods/macos.md | 4 +- packaging/installer/netdata-updater.sh | 59 ++++++++++++++++++------ 15 files changed, 220 insertions(+), 156 deletions(-) (limited to 'packaging/installer') diff --git a/packaging/installer/README.md b/packaging/installer/README.md index 9a9beb720..e241ccc59 100644 --- a/packaging/installer/README.md +++ b/packaging/installer/README.md @@ -38,12 +38,6 @@ but we have some hints on what you might want to do next. Explore our [general advanced installation options and troubleshooting](#advanced-installation-options-and-troubleshooting), specific options for the [single line installer](#install-on-linux-with-one-line-installer), or [other installation methods](#other-installation-methods). -#### Agent user interface - -To access the UI provided by the locally installed agent, open a browser and navigate to `http://NODE:19999`, replacing `NODE` with either `localhost` or -the hostname/IP address of the remote node. You can also read more about -[the agent dashboard](https://github.com/netdata/netdata/blob/master/web/gui/README.md). - #### Configuration Discover the recommended way to [configure Netdata's settings or behavior](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md) using our built-in @@ -94,7 +88,7 @@ To install, copy the script, paste it into your node's terminal, and hit `Enter` > If you plan to also claim the node to Netdata Cloud, make sure to replace `YOUR_CLAIM_TOKEN` with the claim token of your space, and `YOUR_ROOM_ID` with the ID of the room you are claiming to. > You can leave the room id blank to have your node claimed to the default "All nodes" room. -Jump down to [what's next](#whats-next) to learn how to view your new dashboard and take your next steps monitoring and +Jump up to [what's next](#whats-next) to learn how to view your new dashboard and take your next steps in monitoring and troubleshooting with Netdata. ## Other installation methods @@ -227,7 +221,7 @@ PowerTools, to gather hard dependencies. See the [CentOS 6](https://github.com/n #### Access to file is not permitted -If you see an error similar to `Access to file is not permitted: /usr/share/netdata/web//index.html` when you try to +If you see an error similar to `Access to file is not permitted: /usr/share/netdata/web/index.html` when you try to visit the Agent dashboard at `http://NODE:19999`, you need to update Netdata's permissions to match those of your system. @@ -244,7 +238,7 @@ These files need to have the same user and group used to install your netdata. S `netdata` and group `netdata`, in this scenario you will need to run the following command to fix the error: ```bash -# chown -R netdata.netdata /usr/share/netdata/web +# chown -R netdata:netdata /usr/share/netdata/web ``` #### Multiple versions of OpenSSL diff --git a/packaging/installer/UPDATE.md b/packaging/installer/UPDATE.md index 492f464e4..b1f779162 100644 --- a/packaging/installer/UPDATE.md +++ b/packaging/installer/UPDATE.md @@ -182,3 +182,6 @@ The following configuration options are currently supported: as a scheduled task. This random delay helps avoid issues resulting from too many nodes trying to reconnect to the Cloud at the same time. The default value is 3600, which corresponds to one hour. Most users should not ever need to change this. +- `NETDATA_NO_SYSTEMD_JOURNAL`: If set to a value other than 0, skip attempting to install the + `netdata-plugin-systemd-journal` package on supported systems on update. This optional package will be installed + by default on supported systems by the updater if this option is not set. Only affects systems using native packages. diff --git a/packaging/installer/dependencies/centos.sh b/packaging/installer/dependencies/centos.sh index 845f1113a..7d7c6cb40 100755 --- a/packaging/installer/dependencies/centos.sh +++ b/packaging/installer/dependencies/centos.sh @@ -5,30 +5,31 @@ set -e declare -a package_tree=( - gcc - gcc-c++ - make autoconf autoconf-archive automake + cmake + curl + elfutils-libelf-devel + gcc + gcc-c++ + git + gzip + json-c-devel libatomic + libmnl-devel libtool - pkgconfig - cmake - zlib-devel libuuid-devel - libmnl-devel - json-c-devel - libyaml-devel libuv-devel + libyaml-devel lz4-devel + make openssl-devel + pkgconfig python3 - elfutils-libelf-devel - git + systemd-devel tar - curl - gzip + zlib-devel ) os_version() { diff --git a/packaging/installer/dependencies/clearlinux.sh b/packaging/installer/dependencies/clearlinux.sh index f6f616d66..67d3ea24f 100755 --- a/packaging/installer/dependencies/clearlinux.sh +++ b/packaging/installer/dependencies/clearlinux.sh @@ -9,22 +9,23 @@ DONT_WAIT=0 declare -a package_tree=( c-basic - make - sysadmin-basic - devpkg-zlib - devpkg-util-linux - devpkg-libmnl + curl + devpkg-elfutils devpkg-json-c - yaml-dev + devpkg-libmnl devpkg-libuv devpkg-lz4 devpkg-openssl - devpkg-elfutils - git + devpkg-util-linux + devpkg-zlib findutils - curl + git gzip + make python3-basic + service-os-dev + sysadmin-basic + yaml-dev ) usage() { diff --git a/packaging/installer/dependencies/debian.sh b/packaging/installer/dependencies/debian.sh index 8186940e5..09a5d6338 100755 --- a/packaging/installer/dependencies/debian.sh +++ b/packaging/installer/dependencies/debian.sh @@ -8,32 +8,33 @@ NON_INTERACTIVE=0 DONT_WAIT=0 package_tree=" - git - gcc - g++ - make - automake - cmake autoconf autoconf-archive autogen - libatomic1 - libtool - pkg-config - tar + automake + cmake curl + g++ + gcc + git gzip - zlib1g-dev - uuid-dev - libmnl-dev + libatomic1 + libelf-dev libjson-c-dev - libuv1-dev liblz4-dev + libmnl-dev libssl-dev - libelf-dev + libsystemd-dev + libtool + libuv1-dev libyaml-dev + make + pkg-config python python3 + tar + uuid-dev + zlib1g-dev " usage() { diff --git a/packaging/installer/dependencies/fedora.sh b/packaging/installer/dependencies/fedora.sh index 589122882..a457ef2e2 100755 --- a/packaging/installer/dependencies/fedora.sh +++ b/packaging/installer/dependencies/fedora.sh @@ -24,32 +24,33 @@ else fi declare -a package_tree=( - findutils - gcc - gcc-c++ - make autoconf autoconf-archive autogen automake + cmake + curl + elfutils-libelf-devel + findutils + gcc + gcc-c++ + git + gzip + json-c-devel libatomic + libmnl-devel libtool - cmake - zlib-devel libuuid-devel - libmnl-devel - json-c-devel - libyaml-devel libuv-devel + libyaml-devel lz4-devel + make openssl-devel - elfutils-libelf-devel - git pkgconfig - tar - curl - gzip python3 + systemd-devel + tar + zlib-devel "${ulogd_pkg}" ) diff --git a/packaging/installer/dependencies/ol.sh b/packaging/installer/dependencies/ol.sh index 2166bcc50..f0d8341f1 100755 --- a/packaging/installer/dependencies/ol.sh +++ b/packaging/installer/dependencies/ol.sh @@ -8,31 +8,32 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - gcc - gcc-c++ - make autoconf autoconf-archive autogen automake + cmake + curl + elfutils-libelf-devel + gcc + gcc-c++ + git + gzip + json-c-devel libatomic + libmnl-devel libtool - pkgconfig - cmake - tar - zlib-devel libuuid-devel - libmnl-devel - json-c-devel - libyaml-devel libuv-devel + libyaml-devel lz4-devel + make openssl-devel + pkgconfig python3 - elfutils-libelf-devel - git - curl - gzip + systemd-devel + tar + zlib-devel ) prompt() { diff --git a/packaging/installer/dependencies/opensuse.sh b/packaging/installer/dependencies/opensuse.sh index 81291ef72..3f14d58be 100755 --- a/packaging/installer/dependencies/opensuse.sh +++ b/packaging/installer/dependencies/opensuse.sh @@ -10,31 +10,32 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - gcc - gcc-c++ - make autoconf autoconf-archive autogen automake - libatomic1 - libtool - pkg-config cmake - zlib-devel - libuuid-devel - libmnl-devel + curl + gcc + gcc-c++ + git + gzip + libatomic1 + libelf-devel libjson-c-devel - libyaml-devel - libuv-devel liblz4-devel + libmnl-devel libopenssl-devel - libelf-devel - git - tar - curl - gzip + libtool + libuuid-devel + libuv-devel + libyaml-devel + make + pkg-config python3 + systemd-devel + tar + zlib-devel ) usage() { diff --git a/packaging/installer/dependencies/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh index 7ac98f5e2..f90b997bb 100755 --- a/packaging/installer/dependencies/rockylinux.sh +++ b/packaging/installer/dependencies/rockylinux.sh @@ -8,31 +8,32 @@ NON_INTERACTIVE=0 DONT_WAIT=0 declare -a package_tree=( - gcc - gcc-c++ - make autoconf autoconf-archive autogen automake + cmake + curl + elfutils-libelf-devel + gcc + gcc-c++ + git + gzip + json-c-devel libatomic + libmnl-devel libtool - pkgconfig - cmake - zlib-devel libuuid-devel - libmnl-devel - json-c-devel - libyaml-devel libuv-devel + libyaml-devel lz4-devel + make openssl-devel + pkgconfig python3 - elfutils-libelf-devel - git + systemd-devel tar - curl - gzip + zlib-devel ) prompt() { diff --git a/packaging/installer/dependencies/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh index e3d734c68..a5dc2eae5 100755 --- a/packaging/installer/dependencies/ubuntu.sh +++ b/packaging/installer/dependencies/ubuntu.sh @@ -8,31 +8,32 @@ NON_INTERACTIVE=0 DONT_WAIT=0 package_tree=" - git - gcc - g++ - make - automake - cmake autoconf autoconf-archive autogen - libatomic1 - libtool - pkg-config - tar + automake + cmake curl + g++ + gcc + git gzip - zlib1g-dev - uuid-dev - libmnl-dev + libatomic1 + libelf-dev libjson-c-dev - libyaml-dev - libuv1-dev liblz4-dev + libmnl-dev libssl-dev - libelf-dev + libsystemd-dev + libtool + libuv1-dev + libyaml-dev + make + pkg-config python3 + tar + uuid-dev + zlib1g-dev " usage() { cat << EOF diff --git a/packaging/installer/install-required-packages.sh b/packaging/installer/install-required-packages.sh index a05d7440e..9eba38457 100755 --- a/packaging/installer/install-required-packages.sh +++ b/packaging/installer/install-required-packages.sh @@ -708,6 +708,19 @@ declare -A pkg_libatomic=( ['default']="libatomic" ) +declare -A pkg_libsystemd_dev=( + ['alpine']="NOTREQUIRED" + ['arch']="NOTREQUIRED" # inherently present on systems actually using systemd + ['clearlinux']="system-os-dev" + ['debian']="libsystemd-dev" + ['freebsd']="NOTREQUIRED" + ['gentoo']="NOTREQUIRED" # inherently present on systems actually using systemd + ['macos']="NOTREQUIRED" + ['sabayon']="NOTREQUIRED" # inherently present on systems actually using systemd + ['ubuntu']="libsystemd-dev" + ['default']="systemd-devel" +) + declare -A pkg_bridge_utils=( ['gentoo']="net-misc/bridge-utils" ['clearlinux']="network-basic" @@ -1247,6 +1260,7 @@ packages() { suitable_package libmnl-dev suitable_package json-c-dev suitable_package libyaml-dev + suitable_package libsystemd-dev fi # ------------------------------------------------------------------------- diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 31930f9d4..2d793eafd 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -50,7 +50,7 @@ SELECTED_INSTALL_METHOD="none" INSTALL_TYPE="unknown" INSTALL_PREFIX="" NETDATA_AUTO_UPDATES="default" -NETDATA_CLAIM_URL="https://api.netdata.cloud" +NETDATA_CLAIM_URL="https://app.netdata.cloud" NETDATA_COMMAND="default" NETDATA_DISABLE_CLOUD=0 NETDATA_INSTALLER_OPTIONS="" @@ -257,14 +257,16 @@ telemetry_event() { TOTAL_RAM="$((TOTAL_RAM * 1024))" fi + MD5_PATH="$(exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum)" + if [ "${KERNEL_NAME}" = Darwin ] && command -v ioreg >/dev/null 2>&1; then DISTINCT_ID="macos-$(ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }')" - elif [ -f /etc/machine-id ]; then - DISTINCT_ID="machine-$(cat /etc/machine-id)" - elif [ -f /var/db/dbus/machine-id ]; then - DISTINCT_ID="dbus-$(cat /var/db/dbus/machine-id)" - elif [ -f /var/lib/dbus/machine-id ]; then - DISTINCT_ID="dbus-$(cat /var/lib/dbus/machine-id)" + elif [ -f /etc/machine-id ] && [ -n "$MD5_PATH" ]; then + DISTINCT_ID="machine-$($MD5_PATH < /etc/machine-id | cut -f1 -d" ")" + elif [ -f /var/db/dbus/machine-id ] && [ -n "$MD5_PATH" ]; then + DISTINCT_ID="dbus-$($MD5_PATH < /var/db/dbus/machine-id | cut -f1 -d" ")" + elif [ -f /var/lib/dbus/machine-id ] && [ -n "$MD5_PATH" ]; then + DISTINCT_ID="dbus-$($MD5_PATH < /var/lib/dbus/machine-id | cut -f1 -d" ")" elif command -v uuidgen > /dev/null 2>&1; then DISTINCT_ID="uuid-$(uuidgen | tr '[:upper:]' '[:lower:]')" else @@ -300,7 +302,8 @@ telemetry_event() { "system_kernel_name": "${KERNEL_NAME}", "system_kernel_version": "$(uname -r)", "system_architecture": "$(uname -m)", - "system_total_ram": "${TOTAL_RAM:-unknown}" + "system_total_ram": "${TOTAL_RAM:-unknown}", + "system_distinct_id": "${DISTINCT_ID}" } } EOF @@ -1330,7 +1333,7 @@ check_special_native_deps() { progress "EPEL is available, attempting to install so that required dependencies are available." # shellcheck disable=SC2086 - if ! run_as_root env ${env} ${pm_cmd} install ${pkg_install_opts} epel-release; then + if ! run_as_root env ${env} ${pm_cmd} ${install_subcmd} ${pkg_install_opts} epel-release; then warning "Failed to install EPEL, even though it is required to install native packages on this system." return 1 fi @@ -1350,12 +1353,16 @@ common_rpm_opts() { } common_dnf_opts() { + if [ "${INTERACTIVE}" = "0" ]; then + interactive_opts="-y" + fi if command -v dnf > /dev/null; then pm_cmd="dnf" repo_subcmd="makecache" else pm_cmd="yum" fi + install_subcmd="install" pkg_install_opts="${interactive_opts}" repo_update_opts="${interactive_opts}" uninstall_subcmd="remove" @@ -1390,16 +1397,18 @@ try_package_install() { release="" fi - if [ "${INTERACTIVE}" = "0" ]; then - interactive_opts="-y" - env="DEBIAN_FRONTEND=noninteractive" - else - interactive_opts="" - env="" - fi + interactive_opts="" + env="" case "${DISTRO_COMPAT_NAME}" in debian|ubuntu) + if [ "${INTERACTIVE}" = "0" ]; then + install_subcmd="-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install" + interactive_opts="-y" + env="DEBIAN_FRONTEND=noninteractive" + else + install_subcmd="install" + fi needs_early_refresh=1 pm_cmd="apt-get" repo_subcmd="update" @@ -1427,6 +1436,11 @@ try_package_install() { repo_prefix="${DISTRO_COMPAT_NAME}/${SYSVERSION}" ;; opensuse) + if [ "${INTERACTIVE}" = "0" ]; then + install_subcmd="--non-interactive --no-gpg-checks install" + else + install_subcmd="--no-gpg-checks install" + fi common_rpm_opts pm_cmd="zypper" repo_subcmd="--gpg-auto-import-keys refresh" @@ -1497,7 +1511,7 @@ try_package_install() { fi # shellcheck disable=SC2086 - if ! run_as_root env ${env} ${pm_cmd} install ${pkg_install_opts} "${tmpdir}/${repoconfig_file}"; then + if ! run_as_root env ${env} ${pm_cmd} ${install_subcmd} ${pkg_install_opts} "${tmpdir}/${repoconfig_file}"; then warning "Failed to install repository configuration package." return 2 fi @@ -1546,7 +1560,7 @@ try_package_install() { fi # shellcheck disable=SC2086 - if ! run_as_root env ${env} ${pm_cmd} install ${pkg_install_opts} "netdata${NATIVE_VERSION}"; then + if ! run_as_root env ${env} ${pm_cmd} ${install_subcmd} ${pkg_install_opts} "netdata${NATIVE_VERSION}"; then warning "Failed to install Netdata package." if [ -z "${NO_CLEANUP}" ]; then progress "Attempting to uninstall repository configuration package." @@ -1559,7 +1573,7 @@ try_package_install() { if [ -n "${explicitly_install_native_plugins}" ]; then progress "Installing external plugins." # shellcheck disable=SC2086 - if ! run_as_root env ${env} ${pm_cmd} install ${DEFAULT_PLUGIN_PACKAGES}; then + if ! run_as_root env ${env} ${pm_cmd} ${install_subcmd} ${DEFAULT_PLUGIN_PACKAGES}; then warning "Failed to install external plugin packages. Some collectors may not be available." fi fi diff --git a/packaging/installer/methods/kickstart.md b/packaging/installer/methods/kickstart.md index 374ac594a..bdead412e 100644 --- a/packaging/installer/methods/kickstart.md +++ b/packaging/installer/methods/kickstart.md @@ -98,13 +98,13 @@ The `kickstart.sh` script accepts a number of optional parameters to control how - `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in. - `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy. See [connecting through a proxy](https://github.com/netdata/netdata/blob/master/claim/README.md#connect-through-a-proxy) for details. -- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`. +- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://app.netdata.cloud`. - `--override-distro`: Override the distro detection logic and assume the system is using a specific Linux distribution and release. Takes a single argument consisting of the values of the `ID`, `VERSION_ID`, and `VERSION_CODENAME` fields from `/etc/os-release` for the desired distribution. The following options are mutually exclusive and specifiy special operations other than trying to install Netdata normally or update an existing install: - `--reinstall`: If there is an existing install, reinstall it instead of trying to update it. If there is not an existing install, install netdata normally. -- `--reinstall-even-if-unsafe`: If there is an existing install, reinstall it instead of trying to update it, even if doing so is known to potentially break things (for example, if we cannot detect what tyep of installation it is). If there is not an existing install, install Netdata normally. +- `--reinstall-even-if-unsafe`: If there is an existing install, reinstall it instead of trying to update it, even if doing so is known to potentially break things (for example, if we cannot detect what type of installation it is). If there is not an existing install, install Netdata normally. - `--reinstall-clean`: If there is an existing install, uninstall it before trying to install Netdata. Fails if there is no existing install. - `--uninstall`: Uninstall an existing installation of Netdata. Fails if there is no existing install. - `--claim-only`: If there is an existing install, only try to claim it without attempting to update it. If there is no existing install, install and claim Netdata normally. diff --git a/packaging/installer/methods/macos.md b/packaging/installer/methods/macos.md index b09632fa1..e7ff33ed7 100644 --- a/packaging/installer/methods/macos.md +++ b/packaging/installer/methods/macos.md @@ -45,11 +45,11 @@ area](https://github.com/netdata/netdata/blob/master/docs/cloud/manage/organize- - `--claim-rooms`: Specify a comma-separated list of tokens for each War Room this node should appear in. - `--claim-proxy`: Specify a proxy to use when connecting to the cloud in the form of `http://[user:pass@]host:ip` for an HTTP(S) proxy. See [connecting through a proxy](https://github.com/netdata/netdata/blob/master/claim/README.md#connect-through-a-proxy) for details. -- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://api.netdata.cloud`. +- `--claim-url`: Specify a URL to use when connecting to the cloud. Defaults to `https://app.netdata.cloud`. For example: ```bash -curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install-prefix /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://api.netdata.cloud +curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install-prefix /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud ``` The Netdata Agent is installed under `/usr/local/netdata` on your machine. Your machine will also show up as a node in your Netdata Cloud. diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index 8e06923e4..811657c21 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -37,7 +37,9 @@ PACKAGES_SCRIPT="https://raw.githubusercontent.com/netdata/netdata/master/packag NETDATA_STABLE_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata/releases}" NETDATA_NIGHTLY_BASE_URL="${NETDATA_BASE_URL:-https://github.com/netdata/netdata-nightlies/releases}" +# Following variables are intended to be overridden by the updater config file. NETDATA_UPDATER_JITTER=3600 +NETDATA_NO_SYSTEMD_JOURNAL=0 script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" @@ -744,42 +746,57 @@ update_binpkg() { esac fi - if [ "${INTERACTIVE}" = "0" ]; then - interactive_opts="-y" - env="DEBIAN_FRONTEND=noninteractive" - else - interactive_opts="" - env="" - fi + interactive_opts="" + env="" case "${DISTRO_COMPAT_NAME}" in debian|ubuntu) + if [ "${INTERACTIVE}" = "0" ]; then + upgrade_subcmd="-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold --only-upgrade install" + interactive_opts="-y" + env="DEBIAN_FRONTEND=noninteractive" + else + upgrade_subcmd="--only-upgrade install" + fi pm_cmd="apt-get" repo_subcmd="update" - upgrade_cmd="--only-upgrade install" + install_subcmd="install" + mark_auto_cmd="apt-mark auto" pkg_install_opts="${interactive_opts}" repo_update_opts="${interactive_opts}" - pkg_installed_check="dpkg -s" + pkg_installed_check="dpkg-query -s" INSTALL_TYPE="binpkg-deb" ;; centos|fedora|ol|amzn) + if [ "${INTERACTIVE}" = "0" ]; then + interactive_opts="-y" + fi if command -v dnf > /dev/null; then pm_cmd="dnf" repo_subcmd="makecache" + mark_auto_cmd="dnf mark remove" else pm_cmd="yum" + mark_auto_cmd="yumdb set reason dep" fi - upgrade_cmd="upgrade" + upgrade_subcmd="upgrade" + install_subcmd="install" pkg_install_opts="${interactive_opts}" repo_update_opts="${interactive_opts}" pkg_installed_check="rpm -q" INSTALL_TYPE="binpkg-rpm" ;; opensuse) + if [ "${INTERACTIVE}" = "0" ]; then + upgrade_subcmd="--non-interactive update" + else + upgrade_subcmd="update" + fi pm_cmd="zypper" repo_subcmd="--gpg-auto-import-keys refresh" - upgrade_cmd="update" - pkg_install_opts="${interactive_opts}" + install_subcmd="install" + mark_auto_cmd="" + pkg_install_opts="" repo_update_opts="" pkg_installed_check="rpm -q" INSTALL_TYPE="binpkg-rpm" @@ -798,7 +815,7 @@ update_binpkg() { for repopkg in netdata-repo netdata-repo-edge; do if ${pkg_installed_check} ${repopkg} > /dev/null 2>&1; then # shellcheck disable=SC2086 - env ${env} ${pm_cmd} ${upgrade_cmd} ${pkg_install_opts} ${repopkg} >&3 2>&3 || fatal "Failed to update Netdata repository config." U000D + env ${env} ${pm_cmd} ${upgrade_subcmd} ${pkg_install_opts} ${repopkg} >&3 2>&3 || fatal "Failed to update Netdata repository config." U000D # shellcheck disable=SC2086 if [ -n "${repo_subcmd}" ]; then env ${env} ${pm_cmd} ${repo_subcmd} ${repo_update_opts} >&3 2>&3 || fatal "Failed to update repository metadata." U000E @@ -807,7 +824,21 @@ update_binpkg() { done # shellcheck disable=SC2086 - env ${env} ${pm_cmd} ${upgrade_cmd} ${pkg_install_opts} netdata >&3 2>&3 || fatal "Failed to update Netdata package." U000F + env ${env} ${pm_cmd} ${upgrade_subcmd} ${pkg_install_opts} netdata >&3 2>&3 || fatal "Failed to update Netdata package." U000F + + if ${pkg_installed_check} systemd > /dev/null 2>&1; then + if [ "${NETDATA_NO_SYSTEMD_JOURNAL}" -eq 0 ]; then + if ! ${pkg_installed_check} netdata-plugin-systemd-journal > /dev/null 2>&1; then + env ${env} ${pm_cmd} ${install_subcmd} ${pkg_install_opts} netdata-plugin-systemd-journal >&3 2>&3 + + if [ -n "${mark_auto_cmd}" ]; then + # shellcheck disable=SC2086 + env ${env} ${mark_auto_cmd} netdata-plugin-systemd-journal >&3 2>&3 + fi + fi + fi + fi + [ -n "${logfile}" ] && rm "${logfile}" && logfile= return 0 } -- cgit v1.2.3