summaryrefslogtreecommitdiffstats
path: root/packaging/installer/dependencies/freebsd.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-02-15 03:25:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-02-15 03:25:22 +0000
commit0ce692f2add209c6f5d449ee2be7af725f1813e8 (patch)
tree2af915c6ff875c3b0b4367c334032726d2d6839a /packaging/installer/dependencies/freebsd.sh
parentAdding upstream version 1.33.0. (diff)
downloadnetdata-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/freebsd.sh')
-rwxr-xr-xpackaging/installer/dependencies/freebsd.sh145
1 files changed, 145 insertions, 0 deletions
diff --git a/packaging/installer/dependencies/freebsd.sh b/packaging/installer/dependencies/freebsd.sh
index e69de29b..f9c53f42 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