diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-02-15 03:25:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-02-15 03:25:22 +0000 |
commit | 0ce692f2add209c6f5d449ee2be7af725f1813e8 (patch) | |
tree | 2af915c6ff875c3b0b4367c334032726d2d6839a /packaging/installer/dependencies/alpine.sh | |
parent | Adding upstream version 1.33.0. (diff) | |
download | netdata-0ce692f2add209c6f5d449ee2be7af725f1813e8.tar.xz netdata-0ce692f2add209c6f5d449ee2be7af725f1813e8.zip |
Adding upstream version 1.33.1.upstream/1.33.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/dependencies/alpine.sh')
-rwxr-xr-x | packaging/installer/dependencies/alpine.sh | 99 |
1 files changed, 99 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 |