From adcd23e311f47117b60183581cede400d3f3d76d Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Wed, 14 Jul 2021 14:03:10 -0700 Subject: [PATCH] Add install dust script --- install-scripts/.local/bin/install-dust | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 install-scripts/.local/bin/install-dust diff --git a/install-scripts/.local/bin/install-dust b/install-scripts/.local/bin/install-dust new file mode 100755 index 0000000..6eaabc2 --- /dev/null +++ b/install-scripts/.local/bin/install-dust @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +function get_os () { + case $(uname -s) in + Linux*) echo unknown-linux-gnu;; + Darwin*) echo apple-darwin;; + *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; + esac +} + +APP=dust +VERSION=${VERSION:-0.6.0} +DEST="${XDG_DATA_HOME}/apps/releases/${APP}" +URL="https://github.com/bootandy/dust/releases/download/v${VERSION}/dust-v${VERSION}-$(uname -m)-$(get_os).tar.gz" + +extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1" +set_current_link "${DEST}" "${VERSION}" + +cd "$XDG_BIN_HOME" || exit 1 +unlink_if_set "$XDG_BIN_HOME/${APP}" +ln -s "$(relative_path "${XDG_BIN_HOME}" "${DEST}/current/${APP}")" ${APP} +cd - >/dev/null || exit 1