From ba194e4bc42a405f25679b94d4f4ce438023e750 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Tue, 24 Oct 2023 13:56:16 -0700 Subject: [PATCH] Add bws install script --- dot_local/bin/executable_install-bws | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 dot_local/bin/executable_install-bws diff --git a/dot_local/bin/executable_install-bws b/dot_local/bin/executable_install-bws new file mode 100755 index 0000000..400a8af --- /dev/null +++ b/dot_local/bin/executable_install-bws @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +APP=bws +VERSION=${VERSION:-0.3.0} +DEST=${XDG_DATA_HOME}/apps/releases/${APP} + +main() ( + URL=https://github.com/bitwarden/sdk/releases/download/bws-v${VERSION}/bws-$(uname -m)-$(get_os)-${VERSION}.zip + + extract_zip "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +) + +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 +} + +main "${@}"