You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
725 B
Plaintext
25 lines
725 B
Plaintext
4 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
2 years ago
|
set -euo pipefail
|
||
4 years ago
|
|
||
2 years ago
|
# shellcheck disable=SC1091
|
||
4 years ago
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
||
|
|
||
|
APP=node_exporter
|
||
2 years ago
|
VERSION=${VERSION:-1.5.0}
|
||
4 years ago
|
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
|
||
2 years ago
|
if [[ ! -s $bin ]]; then
|
||
|
sudo ln --symbolic \
|
||
|
"$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \
|
||
|
"${bin}"
|
||
|
fi
|
||
4 years ago
|
done
|