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/debian.sh | |
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 '')
-rwxr-xr-x | packaging/installer/dependencies/debian.sh | 108 |
1 files changed, 108 insertions, 0 deletions
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 |