From 3c6ab09dc1dbc55365ae62ea9f0004cf08a002ea Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Tue, 1 Jun 2021 23:59:59 -0700 Subject: [PATCH] Add install traefik script --- base/.local/share/buddy-up/includes/utils.sh | 2 +- hellotech/.local/bin/install-traefik-home | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 hellotech/.local/bin/install-traefik-home diff --git a/base/.local/share/buddy-up/includes/utils.sh b/base/.local/share/buddy-up/includes/utils.sh index 47e3e9e..ce0e215 100644 --- a/base/.local/share/buddy-up/includes/utils.sh +++ b/base/.local/share/buddy-up/includes/utils.sh @@ -64,7 +64,7 @@ extract_tarball () { fi $sudo mkdir -p "${dest}" - tmp_dir="$(mktemp --directory)" + tmp_dir="$(mktemp -d)" tarball=${tmp_dir}/release.tar.gz curl --silent --location --output "${tarball}" "${url}" # shellcheck disable=SC2086 diff --git a/hellotech/.local/bin/install-traefik-home b/hellotech/.local/bin/install-traefik-home new file mode 100755 index 0000000..5286286 --- /dev/null +++ b/hellotech/.local/bin/install-traefik-home @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC1090 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +APP=traefik +VERSION=${VERSION:-2.4.8} +DEST="${XDG_DATA_HOME}/apps/releases/${APP}" + +URL=https://github.com/traefik/traefik/releases/download/v${VERSION}/traefik_v${VERSION}_$(get_os)_$(get_arch).tar.gz +extract_tarball "${URL}" "${DEST}/${VERSION}" +set_current_link "${DEST}" "${VERSION}" + +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}" "${DEST}/current/${APP}")" +ln -s "${REL_LINK}" ${APP}