From 3acc30f058e01d592cba8b491e9107b5eabd9fe0 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Wed, 31 Mar 2021 18:51:41 -0700 Subject: [PATCH] Add script to install prometheus system wide --- .../.local/bin/install-prometheus-system | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 install-scripts/.local/bin/install-prometheus-system diff --git a/install-scripts/.local/bin/install-prometheus-system b/install-scripts/.local/bin/install-prometheus-system new file mode 100755 index 0000000..6527981 --- /dev/null +++ b/install-scripts/.local/bin/install-prometheus-system @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e +set -x + +# shellcheck disable=SC1090 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +APP=prometheus +VERSION=${VERSION:-2.26.0} +APPS_DIR=/usr/local/apps/${APP} +URL=https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.$(get_os)-$(get_arch).tar.gz + +extract_tarball "${URL}" "${APPS_DIR}/${VERSION}" "--strip-components 1" sudo +set_current_link "${APPS_DIR}" "${VERSION}" sudo + +apps=$(find ${APPS_DIR}/current/ -maxdepth 1 -executable -type f -exec basename {} \;) +cd /usr/local/bin +for bin in $apps; do + if [[ ! -s $bin ]]; then + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ + "${bin}" + fi +done