Browse Source

Fixes NetData installer on *BSD systems post libmosquitto / eBPF (#8121)

* Fixed bad usage of mktemp with mixed -t/-d options

* Fixed bad copy/pasta of wrong grep ./packaging/*.checksums to generate sha256sums.txt for libmosquitto

* Disabled bundling/building of custom libmosquitto fork on *BSD systems (for now) as it is broken

* Skip trying to install eBPF Collector Package(s) on non-Linux systems

* Update netdata-installer.sh

Co-Authored-By: Konstantinos Natsakis <5933427+knatsakis@users.noreply.github.com>

Co-authored-by: Konstantinos Natsakis <5933427+knatsakis@users.noreply.github.com>
James Mills 5 years ago
parent
commit
3e970168ad
1 changed files with 21 additions and 11 deletions
  1. 21 11
      netdata-installer.sh

+ 21 - 11
netdata-installer.sh

@@ -456,11 +456,17 @@ bundle_libmosquitto() {
     return 0
   fi
 
+  if [ "$(uname)" != "Linux" ]; then
+    echo >&2 " Sorry NetData with custom libmosquitto is unsupported on $(uname) at this time!"
+    echo >&2 " Please contact NetData suppoort! https://github.com/netdata/netdata/issues/new"
+    return 0
+  fi
+
   progress "Prepare custom libmosquitto version"
 
   MOSQUITTO_PACKAGE_VERSION="$(cat packaging/mosquitto.version)"
 
-  tmp=$(mktemp -t -d netdata-mosquitto-XXXXXX)
+  tmp="$(mktemp -d -t netdata-mosquitto-XXXXXX)"
   MOSQUITTO_PACKAGE_BASENAME="${MOSQUITTO_PACKAGE_VERSION}.tar.gz"
 
   if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE_MOSQUITTO}" ]; then
@@ -475,9 +481,7 @@ bundle_libmosquitto() {
     return 0
   fi
 
-  grep "${MOSQUITTO_PACKAGE_BASENAME}\$" "${INSTALLER_DIR}/packaging/go.d.checksums" > "${tmp}/sha256sums.txt" 2> /dev/null
-
-  cp packaging/mosquitto.checksums "${tmp}/sha256sums.txt"
+  grep "${MOSQUITTO_PACKAGE_BASENAME}\$" "${INSTALLER_DIR}/packaging/mosquitto.checksums" > "${tmp}/sha256sums.txt" 2> /dev/null
 
   # Checksum validation
   if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
@@ -861,10 +865,10 @@ if [ "${UID}" -eq 0 ]; then
     run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ioping"
   fi
 
-	if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin" ]; then
-		run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin"
-		run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin"
-	fi
+  if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin" ]; then
+    run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin"
+    run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ebpf_process.plugin"
+  fi
 
   if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/cgroup-network" ]; then
     run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/cgroup-network"
@@ -975,7 +979,7 @@ install_go() {
       break
     fi
   done
-  tmp=$(mktemp -t -d netdata-go-XXXXXX)
+  tmp="$(mktemp -d -t netdata-go-XXXXXX)"
   GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}.tar.gz"
 
   if [ -z "${NETDATA_LOCAL_TARBALL_OVERRIDE_GO_PLUGIN}" ]; then
@@ -1092,6 +1096,12 @@ should_install_ebpf() {
     return 1
   fi
 
+  if [ "$(uname)" != "Linux" ]; then
+    echo >&2 " Sorry eBPF Collector is currently unsupproted on $(uname) Systems at this time."
+    echo >&2 " Please contact NetData suppoort! https://github.com/netdata/netdata/issues/new"
+    return 1
+  fi
+
   # Get and Parse Kernel Version
   kver="$(get_kernel_version)"
   kver="${kver:-0}"
@@ -1105,7 +1115,7 @@ should_install_ebpf() {
 
   # Check Kernel Config
 
-  tmp="$(mktemp -t -d netdata-ebpf-XXXXXX)"
+  tmp="$(mktemp -d -t netdata-ebpf-XXXXXX)"
 
   echo >&2 " Downloading check-kernel-config.sh ..."
   if ! get "https://raw.githubusercontent.com/netdata/kernel-collector/master/tools/check-kernel-config.sh" > "${tmp}"/check-kernel-config.sh; then
@@ -1158,7 +1168,7 @@ install_ebpf() {
     return 1
   fi
 
-  tmp="$(mktemp -t -d netdata-ebpf-XXXXXX)"
+  tmp="$(mktemp -d -t netdata-ebpf-XXXXXX)"
 
   echo >&2 " Downloading eBPF Package ${PACKAGE_TARBALL_URL} ..."
   if ! get "${PACKAGE_TARBALL_URL}" > "${tmp}"/"${PACKAGE_TARBALL}"; then