diff options
Diffstat (limited to 'packaging/installer/dependencies')
-rwxr-xr-x | packaging/installer/dependencies/alpine.sh | 99 | ||||
-rwxr-xr-x | packaging/installer/dependencies/arch.sh | 101 | ||||
-rwxr-xr-x | packaging/installer/dependencies/centos.sh | 185 | ||||
-rwxr-xr-x | packaging/installer/dependencies/clearlinux.sh | 87 | ||||
-rwxr-xr-x | packaging/installer/dependencies/debian.sh | 105 | ||||
-rwxr-xr-x | packaging/installer/dependencies/fedora.sh | 119 | ||||
-rwxr-xr-x | packaging/installer/dependencies/freebsd.sh | 145 | ||||
-rwxr-xr-x | packaging/installer/dependencies/gentoo.sh | 99 | ||||
-rwxr-xr-x | packaging/installer/dependencies/ol.sh | 144 | ||||
-rwxr-xr-x | packaging/installer/dependencies/opensuse.sh | 103 | ||||
-rwxr-xr-x | packaging/installer/dependencies/rockylinux.sh | 162 | ||||
-rwxr-xr-x | packaging/installer/dependencies/ubuntu.sh | 102 |
12 files changed, 1451 insertions, 0 deletions
diff --git a/packaging/installer/dependencies/alpine.sh b/packaging/installer/dependencies/alpine.sh index e69de29bb..8cbd98adf 100755 --- a/packaging/installer/dependencies/alpine.sh +++ b/packaging/installer/dependencies/alpine.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# 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 + libtool + pkgconfig + tar + curl + gzip + netcat-openbsd + libuv-dev + lz4-dev + openssl-dev + elfutils-dev + python3 + zlib-dev + util-linux-dev + libmnl-dev + json-c-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 apk -e info "$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="--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 index e69de29bb..fbad75406 100755 --- a/packaging/installer/dependencies/arch.sh +++ b/packaging/installer/dependencies/arch.sh @@ -0,0 +1,101 @@ +#!/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 + gnu-netcat + zlib + util-linux + libmnl + json-c + libuv + lz4 + openssl + judy + libelf + git + pkgconfig + tar + curl + gzip + python3 + binutils +) + +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 index e69de29bb..d17911664 100755 --- a/packaging/installer/dependencies/centos.sh +++ b/packaging/installer/dependencies/centos.sh @@ -0,0 +1,185 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << CentOS: [7] [8] >> + +set -e + +declare -a package_tree=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkgconfig + cmake + nmap-ncat + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + python3 + elfutils-libelf-devel + git + tar + curl + gzip +) + +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 "Erorr: 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= + export local 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) =~ ^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 + + echo >&2 " > Installing Judy-devel directly ..." + dnf ${opts} install http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/Judy-devel-1.0.5-18.module_el8.3.0+757+d382997d.x86_64.rpm + dnf makecache --refresh +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 index e69de29bb..832dac55a 100755 --- a/packaging/installer/dependencies/clearlinux.sh +++ b/packaging/installer/dependencies/clearlinux.sh @@ -0,0 +1,87 @@ +#!/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 + make + sysadmin-basic + devpkg-zlib + devpkg-util-linux + devpkg-libmnl + devpkg-json-c + devpkg-libuv + devpkg-lz4 + devpkg-openssl + devpkg-elfutils + git + findutils + curl + gzip + python3-basic +) + +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 index e69de29bb..66a4b6826 100755 --- a/packaging/installer/dependencies/debian.sh +++ b/packaging/installer/dependencies/debian.sh @@ -0,0 +1,105 @@ +#!/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=" + git + gcc + g++ + make + automake + cmake + autoconf + autoconf-archive + autogen + libtool + pkg-config + tar + curl + gzip + netcat + zlib1g-dev + uuid-dev + libmnl-dev + libjson-c-dev + libuv1-dev + liblz4-dev + libssl-dev + libjudy-dev + libelf-dev + python + python3 + " + +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 000000000..edb695bca --- /dev/null +++ b/packaging/installer/dependencies/fedora.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Fedora: [24->35] >> + +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 "Erorr: Cannot determine OS version!" + exit 1 + fi +} + +if [[ $(os_version) -gt 24 ]]; then + ulogd_pkg= +else + ulogd_pkg=ulogd +fi + +declare -a package_tree=( + findutils + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + cmake + nmap-ncat + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + Judy-devel + elfutils-libelf-devel + git + pkgconfig + tar + curl + gzip + python3 + "${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 index e69de29bb..f9c53f428 100755 --- a/packaging/installer/dependencies/freebsd.sh +++ 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 + gcc + autoconf + autoconf-archive + autogen + automake + libtool + pkgconf + cmake + curl + gzip + netcat + lzlib + e2fsprogs-libuuid + json-c + libuv + liblz4 + openssl + Judy + python3 + " + +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 index e69de29bb..ae1a4af27 100755 --- a/packaging/installer/dependencies/gentoo.sh +++ b/packaging/installer/dependencies/gentoo.sh @@ -0,0 +1,99 @@ +#!/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 + net-analyzer/netcat + sys-apps/util-linux + net-libs/libmnl + dev-libs/json-c + dev-libs/libuv + app-arch/lz4 + dev-libs/openssl + dev-libs/judy + virtual/libelf + dev-lang/python + dev-libs/libuv + " +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/ol.sh b/packaging/installer/dependencies/ol.sh index e69de29bb..4b95722a8 100755 --- a/packaging/installer/dependencies/ol.sh +++ b/packaging/installer/dependencies/ol.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +# Package tree used for installing netdata on distribution: +# << Oracle Linux: [8] >> + +set -e + +NON_INTERACTIVE=0 +DONT_WAIT=0 + +declare -a package_tree=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkgconfig + cmake + nmap-ncat + tar + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + python3 + elfutils-libelf-devel + git + curl + gzip +) + +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 + + + 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 ! dnf repolist | 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 + + 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 index e69de29bb..cfaaf6753 100755 --- a/packaging/installer/dependencies/opensuse.sh +++ b/packaging/installer/dependencies/opensuse.sh @@ -0,0 +1,103 @@ +#!/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=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkg-config + cmake + netcat-openbsd + zlib-devel + libuuid-devel + libmnl-devel + libjson-c-devel + libuv-devel + liblz4-devel + libopenssl-devel + judy-devel + libelf-devel + git + tar + curl + gzip + python3 +) + +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/rockylinux.sh b/packaging/installer/dependencies/rockylinux.sh new file mode 100755 index 000000000..1cf07fc58 --- /dev/null +++ b/packaging/installer/dependencies/rockylinux.sh @@ -0,0 +1,162 @@ +#!/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=( + gcc + gcc-c++ + make + autoconf + autoconf-archive + autogen + automake + libtool + pkgconfig + cmake + nmap-ncat + zlib-devel + libuuid-devel + libmnl-devel + json-c-devel + libuv-devel + lz4-devel + openssl-devel + python3 + elfutils-libelf-devel + git + tar + curl + gzip +) + +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/ubuntu.sh b/packaging/installer/dependencies/ubuntu.sh index e69de29bb..3d0bb5959 100755 --- a/packaging/installer/dependencies/ubuntu.sh +++ b/packaging/installer/dependencies/ubuntu.sh @@ -0,0 +1,102 @@ +#!/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=" + git + gcc + g++ + make + automake + cmake + autoconf + autoconf-archive + autogen + libtool + pkg-config + tar + curl + gzip + netcat + zlib1g-dev + uuid-dev + libmnl-dev + libjson-c-dev + libuv1-dev + liblz4-dev + libssl-dev + libjudy-dev + libelf-dev + python3 + " +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 |