Add script to install node_exporter for the system

main
Buddy Sandidge 4 years ago
parent b7658aa976
commit d633bb7396

@ -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=node_exporter
VERSION=${VERSION:-1.1.2}
APPS_DIR=/usr/local/apps/${APP}
URL=https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${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
Loading…
Cancel
Save