diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /packaging/installer/dependencies | |
parent | Initial commit. (diff) | |
download | netdata-upstream.tar.xz netdata-upstream.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/dependencies')
-rwxr-xr-x | packaging/installer/dependencies/alpine.sh | 114 | ||||
-rwxr-xr-x | packaging/installer/dependencies/arch.sh | 102 | ||||
-rwxr-xr-x | packaging/installer/dependencies/centos.sh | 202 | ||||
-rwxr-xr-x | packaging/installer/dependencies/clearlinux.sh | 89 | ||||
-rwxr-xr-x | packaging/installer/dependencies/debian.sh | 108 | ||||
-rwxr-xr-x | packaging/installer/dependencies/fedora.sh | 122 | ||||
-rwxr-xr-x | packaging/installer/dependencies/freebsd.sh | 145 | ||||
-rwxr-xr-x | packaging/installer/dependencies/gentoo.sh | 100 | ||||
-rwxr-xr-x | packaging/installer/dependencies/macos.sh | 0 | ||||
-rwxr-xr-x | packaging/installer/dependencies/ol.sh | 160 | ||||
-rwxr-xr-x | packaging/installer/dependencies/opensuse.sh | 106 | ||||
-rwxr-xr-x | packaging/installer/dependencies/rhel.sh | 0 | ||||
-rwxr-xr-x | packaging/installer/dependencies/rockylinux.sh | 167 | ||||
-rwxr-xr-x | packaging/installer/dependencies/sabayon.sh | 0 | ||||
-rwxr-xr-x | packaging/installer/dependencies/ubuntu.sh | 105 |
15 files changed, 1520 insertions, 0 deletions
diff --git a/packaging/installer/dependencies/alpine.sh b/packaging/installer/dependencies/alpine.sh new file mode 100755 index 00000000..ee0504b3 --- /dev/null +++ b/packaging/installer/dependencies/alpine.sh @@ -0,0 +1,114 @@ +#!/bin/sh +# Package tree used for installing netdata on distribution: +# << Alpine: [3.12] [3.13] [3.14] [3.15] [edge] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + alpine-sdk + git + gcc + g++ + automake + autoconf + cmake + make + libatomic + libtool + pkgconfig + tar + curl + gzip + libuv-dev + lz4-dev + openssl-dev + elfutils-dev + python3 + zlib-dev + util-linux-dev + libmnl-dev + json-c-dev + musl-fts-dev + bison + flex + yaml-dev + " + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + printf "Press ENTER to run it > " + read -r || exit 1 + fi +} + +# shellcheck disable=2068 +check_flags ${@} + +packages_to_install= + +handle_old_alpine() { + version="$(grep VERSION_ID /etc/os-release | cut -f 2 -d '=')" + major="$(echo "${version}" | cut -f 1 -d '.')" + minor="$(echo "${version}" | cut -f 2 -d '.')" + + if [ "${major}" -le 3 ] && [ "${minor}" -le 16 ]; then + package_tree="$(echo "${package_tree}" | sed 's/musl-fts-dev/fts-dev/')" + fi +} + +for package in $package_tree; do + if apk -e info "$package" > /dev/null 2>&1 ; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [ -z "${packages_to_install}" ]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts="--force-broken-world" + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + else + opts="${opts} -i" + fi + # shellcheck disable=SC2086 + apk add ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/arch.sh b/packaging/installer/dependencies/arch.sh new file mode 100755 index 00000000..30be834b --- /dev/null +++ b/packaging/installer/dependencies/arch.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << ArchLinux: [base] [base-devel] >> | << Manjaro >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + gcc + make + autoconf + autoconf-archive + autogen + automake + libtool + cmake + zlib + util-linux + libmnl + json-c + libyaml + libuv + lz4 + openssl + libelf + git + pkgconfig + tar + curl + gzip + python3 + binutils + bison + flex +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if pacman -Qn "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install: " "${packages_to_install[@]}" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="--noconfirm" + fi + # shellcheck disable=SC2068 + pacman -Sy ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/centos.sh b/packaging/installer/dependencies/centos.sh new file mode 100755 index 00000000..532a0a71 --- /dev/null +++ b/packaging/installer/dependencies/centos.sh @@ -0,0 +1,202 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << CentOS: [7] [8] [9] >> + +set -e + +declare -a package_tree=( + autoconf + autoconf-archive + automake + bison + cmake + cmake3 + curl + elfutils-libelf-devel + flex + findutils + gcc + gcc-c++ + git + gzip + json-c-devel + libatomic + libmnl-devel + libtool + libuuid-devel + libuv-devel + libyaml-devel + lz4-devel + make + openssl-devel + pkgconfig + python3 + systemd-devel + tar + zlib-devel +) + +os_version() { + if [[ -f /etc/os-release ]]; then + # shellcheck disable=SC2002 + cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 | cut -d'"' -f2 + else + echo "Error: Cannot determine OS version!" + exit 1 + fi +} + +prompt() { + if [[ "${NON_INTERACTIVE}" == "1" ]]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [[ "${DONT_WAIT}" == "0" ]] && [[ "${NON_INTERACTIVE}" == "0" ]]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_centos() { + local opts= + package_manager= + if [[ "${NON_INTERACTIVE}" == "1" ]]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + echo >&2 " > CentOS Version: $(os_version) ..." + + if [[ $(os_version) =~ ^9(\..*)?$ ]]; then + package_manager=dnf + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager --help &> /dev/null; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo >&2 " > Checking for CRB ..." + if ! dnf repolist | grep CRB; then + if prompt "CRB not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled crb + fi + fi + elif [[ $(os_version) =~ ^8(\..*)?$ ]]; then + package_manager=dnf + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager --help &> /dev/null; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo >&2 " > Checking for PowerTools ..." + if ! dnf repolist | grep PowerTools; then + if prompt "PowerTools not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled powertools || enable_powertools_repo + fi + fi + + echo >&2 " > Updating libarchive ..." + dnf ${opts} install libarchive + + elif [[ $(os_version) =~ ^7(\..*)?$ ]]; then + package_manager=yum + echo >&2 " > Checking for EPEL ..." + if ! rpm -qa | grep epel-release > /dev/null; then + if prompt "EPEL not found, shall I install it?"; then + yum ${opts} install epel-release + fi + fi + yum makecache + fi +} + +enable_powertools_repo() { + if ! dnf repolist | grep -q powertools; then + cat > /etc/yum.repos.d/powertools.repo <<-EOF + [powertools] + name=CentOS Linux \$releasever - PowerTools + mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=PowerTools&infra=\$infra + #baseurl=http://mirror.centos.org/\$contentdir/\$releasever/PowerTools/\$basearch/os/ + gpgcheck=1 + enabled=1 + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial +EOF + else + echo "Something went wrong!" + exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_centos + +packages_to_install= + +for package in "${package_tree[@]}"; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts= + if [[ "${NON_INTERACTIVE}" == "1" ]]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2068 + ${package_manager} install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/clearlinux.sh b/packaging/installer/dependencies/clearlinux.sh new file mode 100755 index 00000000..67d3ea24 --- /dev/null +++ b/packaging/installer/dependencies/clearlinux.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << ClearLinux: [base] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + c-basic + curl + devpkg-elfutils + devpkg-json-c + devpkg-libmnl + devpkg-libuv + devpkg-lz4 + devpkg-openssl + devpkg-util-linux + devpkg-zlib + findutils + git + gzip + make + python3-basic + service-os-dev + sysadmin-basic + yaml-dev +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if [[ "$(swupd bundle-info "$package" | grep Status | cut -d':' -f2)" == " Not installed" ]]; then + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + else + echo "Package '$package' is installed" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install: " "${packages_to_install[@]}" + # shellcheck disable=SC2068 + swupd bundle-add ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/debian.sh b/packaging/installer/dependencies/debian.sh new file mode 100755 index 00000000..692a7119 --- /dev/null +++ b/packaging/installer/dependencies/debian.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Debian: [9] [10] [11] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + autoconf + autoconf-archive + autogen + automake + bison + cmake + curl + flex + g++ + gcc + git + gzip + libatomic1 + libelf-dev + libjson-c-dev + liblz4-dev + libmnl-dev + libssl-dev + libsystemd-dev + libtool + libuv1-dev + libyaml-dev + make + pkg-config + python + python3 + tar + uuid-dev + zlib1g-dev + " + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=2068 +check_flags ${@} + +packages_to_install= + +for package in $package_tree; do + if dpkg -s "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + # shellcheck disable=SC2034 + DEBIAN_FRONTEND="noninteractive" + opts="${opts} -yq" + fi + echo "Running apt-get update and updating your APT caches ..." + apt-get update + # shellcheck disable=2086 + apt-get install ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/fedora.sh b/packaging/installer/dependencies/fedora.sh new file mode 100755 index 00000000..fc30b611 --- /dev/null +++ b/packaging/installer/dependencies/fedora.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Fedora: [24->38] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +os_version() { + if [[ -f /etc/os-release ]]; then + # shellcheck disable=SC2002 + cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 + else + echo "Error: Cannot determine OS version!" + exit 1 + 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 + gzip + json-c-devel + libatomic + libmnl-devel + libtool + libuuid-devel + libuv-devel + libyaml-devel + lz4-devel + make + openssl-devel + pkgconfig + python3 + systemd-devel + tar + zlib-devel + "${ulogd_pkg}" +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2068 + dnf install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/freebsd.sh b/packaging/installer/dependencies/freebsd.sh new file mode 100755 index 00000000..eadbcfa9 --- /dev/null +++ b/packaging/installer/dependencies/freebsd.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << FreeBSD >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + git + autoconf + autoconf-archive + autogen + automake + libtool + pkgconf + cmake + curl + gzip + lzlib + e2fsprogs-libuuid + json-c + libyaml + libuv + liblz4 + openssl + python3 + bison + flex + " + +prompt() { + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_freebsd() { + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + echo >&2 " > Checking for gmake ..." + if ! pkg query %n-%v | grep -q gmake; then + if prompt "gmake is required to build on FreeBSD and is not installed. Shall I install it?"; then + pkg install ${opts} gmake + fi + fi +} + +enable_repo () { + if ! dnf repolist | grep -q codeready; then +cat >> /etc/yum.repos.d/oracle-linux-ol8.repo <<-EOF + +[ol8_codeready_builder] +name=Oracle Linux \$releasever CodeReady Builder (\$basearch) +baseurl=http://yum.oracle.com/repo/OracleLinux/OL8/codeready/builder/\$basearch +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle +gpgcheck=1 +enabled=1 +EOF + else + echo "Something went wrong!" + exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_freebsd + +packages_to_install= + +for package in $package_tree; do + if pkg info -Ix "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2086 + pkg install ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/gentoo.sh b/packaging/installer/dependencies/gentoo.sh new file mode 100755 index 00000000..9cf7f281 --- /dev/null +++ b/packaging/installer/dependencies/gentoo.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Gentoo >> | << Pentoo >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + dev-vcs/git + sys-apps/findutils + 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 + " +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in $package_tree; do + if qlist -IRv "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts="--ask" + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="" + fi + # shellcheck disable=SC2086 + emerge ${opts} $packages_to_install +fi diff --git a/packaging/installer/dependencies/macos.sh b/packaging/installer/dependencies/macos.sh new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/packaging/installer/dependencies/macos.sh diff --git a/packaging/installer/dependencies/ol.sh b/packaging/installer/dependencies/ol.sh new file mode 100755 index 00000000..2dc10cee --- /dev/null +++ b/packaging/installer/dependencies/ol.sh @@ -0,0 +1,160 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Oracle Linux: [8, 9] >> + +set -e + +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 + gzip + json-c-devel + libatomic + libmnl-devel + libtool + libuuid-devel + libuv-devel + libyaml-devel + lz4-devel + make + openssl-devel + pkgconfig + python3 + systemd-devel + tar + zlib-devel +) + +prompt() { + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_ol() { + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + # shellcheck disable=SC1091 + source /etc/os-release + + # shellcheck disable=SC2153 + version="$(echo "${VERSION}" | cut -f 1 -d '.')" + + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager &> /dev/null; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo " > Checking for CodeReady Builder ..." + if [[ "${version}" =~ ^8(\..*)?$ ]]; then + if ! dnf repolist enabled | grep ol8_codeready_builder; then + if prompt "CodeReadyBuilder not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled ol8_codeready_builder || enable_repo + fi + fi + elif [[ "${version}" =~ ^9(\..*)?$ ]]; then + if ! dnf repolist enabled | grep ol9_codeready_builder; then + if prompt "CodeReadyBuilder not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled ol9_codeready_builder || enable_repo + fi + fi + fi + + dnf makecache --refresh +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_ol + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + echo "packages_to_install:" "${packages_to_install[@]}" + # shellcheck disable=SC2068 + dnf install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/opensuse.sh b/packaging/installer/dependencies/opensuse.sh new file mode 100755 index 00000000..ecf1268f --- /dev/null +++ b/packaging/installer/dependencies/opensuse.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << opeSUSE >> +# supported versions: leap/15.3 and tumbleweed +# it may work with SLES as well, although we have not tested with it + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + autoconf + autoconf-archive + autogen + automake + bison + cmake + curl + flex + gcc + gcc-c++ + git + gzip + libatomic1 + libelf-devel + libjson-c-devel + liblz4-devel + libmnl-devel + libopenssl-devel + libtool + libuuid-devel + libuv-devel + libyaml-devel + make + pkg-config + python3 + systemd-devel + tar + zlib-devel +) + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if zypper search -i "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts="--ignore-unknown" + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="--non-interactive" + fi + # shellcheck disable=SC2068 + zypper ${opts} install ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/rhel.sh b/packaging/installer/dependencies/rhel.sh new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/packaging/installer/dependencies/rhel.sh diff --git a/packaging/installer/dependencies/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh new file mode 100755 index 00000000..cc8d4520 --- /dev/null +++ b/packaging/installer/dependencies/rockylinux.sh @@ -0,0 +1,167 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Rocky Linux:[8.5] >> + +set -e + +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 + gzip + json-c-devel + libatomic + libmnl-devel + libtool + libuuid-devel + libuv-devel + libyaml-devel + lz4-devel + make + openssl-devel + pkgconfig + python3 + systemd-devel + tar + zlib-devel +) + +prompt() { + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode, assuming yes (y)" + echo >&2 " > Would have prompted for ${1} ..." + return 0 + fi + + while true; do + read -r -p "${1} [y/n] " yn + case $yn in + [Yy]*) return 0 ;; + [Nn]*) return 1 ;; + *) echo >&2 "Please answer with yes (y) or no (n)." ;; + esac + done +} + +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +validate_tree_rockylinux() { + local opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + + echo >&2 " > Checking for config-manager ..." + if ! dnf config-manager; then + if prompt "config-manager not found, shall I install it?"; then + dnf ${opts} install 'dnf-command(config-manager)' + fi + fi + + echo >&2 " > Checking for PowerTools ..." + if ! dnf repolist | grep PowerTools; then + if prompt "PowerTools not found, shall I install it?"; then + dnf ${opts} config-manager --set-enabled powertools || enable_powertools_repo + fi + fi + + echo >&2 " > Updating libarchive ..." + dnf ${opts} install libarchive + + dnf makecache --refresh +} + +enable_powertools_repo() { + if ! dnf repolist | grep -q powertools; then + cat > /etc/yum.repos.d/powertools.repo <<-EOF + [powertools] + name=Rocky Linux \$releasever - PowerTools + mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=\$basearch&repo=PowerTools-\$releasever + #baseurl=http://dl.rockylinux.org/\$contentdir/\$releasever/PowerTools/\$basearch/os/ + gpgcheck=1 + enabled=1 + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial +EOF + else + echo "Something went wrong!" + exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} +validate_tree_rockylinux + +packages_to_install= + +# shellcheck disable=SC2068 +for package in ${package_tree[@]}; do + if rpm -q "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '$package' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z $packages_to_install ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "${packages_to_install[@]}" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + opts="-y" + fi + # shellcheck disable=SC2068 + dnf install ${opts} ${packages_to_install[@]} +fi diff --git a/packaging/installer/dependencies/sabayon.sh b/packaging/installer/dependencies/sabayon.sh new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/packaging/installer/dependencies/sabayon.sh diff --git a/packaging/installer/dependencies/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh new file mode 100755 index 00000000..e223ca38 --- /dev/null +++ b/packaging/installer/dependencies/ubuntu.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Ubuntu: [18.04] [20.04] [20.10] [21.04] [21.10] >> | << Linux Mint >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +package_tree=" + autoconf + autoconf-archive + autogen + automake + bison + cmake + curl + flex + g++ + gcc + git + gzip + libatomic1 + libelf-dev + libjson-c-dev + liblz4-dev + libmnl-dev + libssl-dev + libsystemd-dev + libtool + libuv1-dev + libyaml-dev + make + pkg-config + python3 + tar + uuid-dev + zlib1g-dev + " +usage() { + cat << EOF +OPTIONS: +[--dont-wait] [--non-interactive] [ ] +EOF +} + +check_flags() { + while [ -n "${1}" ]; do + case "${1}" in + dont-wait | --dont-wait | -n) + DONT_WAIT=1 + ;; + + non-interactive | --non-interactive | -y) + NON_INTERACTIVE=1 + ;; + + help | -h | --help) + usage + exit 1 + ;; + *) + echo >&2 "ERROR: Cannot understand option '${1}'" + echo >&2 + usage + exit 1 + ;; + esac + shift + done + + if [ "${DONT_WAIT}" -eq 0 ] && [ "${NON_INTERACTIVE}" -eq 0 ]; then + read -r -p "Press ENTER to run it > " || exit 1 + fi +} + +# shellcheck disable=SC2068 +check_flags ${@} + +packages_to_install= + +for package in $package_tree; do + if dpkg -s "$package" &> /dev/null; then + echo "Package '${package}' is installed" + else + echo "Package '${package}' is NOT installed" + packages_to_install="$packages_to_install $package" + fi +done + +if [[ -z "$packages_to_install" ]]; then + echo "All required packages are already installed. Skipping .." +else + echo "packages_to_install:" "$packages_to_install" + opts= + if [ "${NON_INTERACTIVE}" -eq 1 ]; then + echo >&2 "Running in non-interactive mode" + export DEBIAN_FRONTEND="noninteractive" + opts="${opts} -yq" + fi + echo "Running apt-get update and updating your APT caches ..." + apt-get update + # shellcheck disable=SC2086 + apt-get install ${opts} $packages_to_install +fi |