From c2b2d277ebe08c4ee153221cf4c6711ca40963f6 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Mon, 19 Jul 2021 01:39:54 -0700 Subject: [PATCH] update direnv install script --- direnv/.local/bin/install-direnv-home | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/direnv/.local/bin/install-direnv-home b/direnv/.local/bin/install-direnv-home index 225d93d..6e5afc6 100755 --- a/direnv/.local/bin/install-direnv-home +++ b/direnv/.local/bin/install-direnv-home @@ -5,28 +5,9 @@ source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=direnv VERSION=${VERSION:-2.28.0} -DATA_DIR="${XDG_DATA_HOME}/apps/releases" -DEST_DIR="${DATA_DIR}/${APP}/${VERSION}" +DEST="${XDG_DATA_HOME}/apps/releases/${APP}" URL=https://github.com/direnv/direnv/releases/download/v${VERSION}/direnv.$(get_os)-$(get_arch) -if [[ ! -d "${DEST_DIR}" ]] ; then - TMP_DIR=$(mktemp -d) - OUTPUT="${TMP_DIR}/${APP}" - curl --location --silent --output "${OUTPUT}" "${URL}" - mkdir -p "${DEST_DIR}" - chmod 755 "${OUTPUT}" - mv -v "${OUTPUT}" "${DEST_DIR}/${APP}" - rm -rf "${TMP_DIR}" -fi - -cd "${DATA_DIR}/${APP}" || exit 1 -[[ -s current ]] && unlink current -ln -s "${VERSION}" current - -if [[ -L "$XDG_BIN_HOME/${APP}" ]]; then - unlink "$XDG_BIN_HOME/${APP}" -fi - -cd "${XDG_BIN_HOME}" || exit 1 -REL_LINK="$(relative_path "${XDG_BIN_HOME}" "${DATA_DIR}/${APP}/current/${APP}")" -[[ -L "${APP}" ]] || ln -s "${REL_LINK}" "${APP}" +extract_tarball "${URL}" "${DEST}/${VERSION}" +set_current_link "${DEST}" "${VERSION}" +set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"