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.
39 lines
871 B
Bash
39 lines
871 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# shellcheck disable=SC1091
|
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
|
|
|
APP=nkeys
|
|
VERSION=${VERSION:-0.4.16}
|
|
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
|
|
|
|
main() (
|
|
ARCHIVE_DIR=nkeys-v${VERSION}-$(get_os)-$(get_arch)
|
|
URL=https://github.com/nats-io/nkeys/releases/download/v${VERSION}/${ARCHIVE_DIR}.zip
|
|
|
|
extract_zip "${URL}" "${DEST}/${VERSION}"
|
|
set_current_link "${DEST}" "${VERSION}"
|
|
set_link "${XDG_BIN_HOME}/nk" "${DEST}" "${ARCHIVE_DIR}/nk"
|
|
)
|
|
|
|
get_arch () (
|
|
case $(uname -m) in
|
|
x86_64*) echo amd64 ;;
|
|
arm64*) echo arm64 ;;
|
|
aarch64*) echo arm64 ;;
|
|
*) >&2 echo "unsupported uname: $(uname -m)"; exit 1 ;;
|
|
esac
|
|
)
|
|
|
|
get_os () (
|
|
case $(uname -s) in
|
|
Linux*) echo linux ;;
|
|
Darwin*) echo darwin ;;
|
|
*) >&2 echo "unsupported os: $(uname -s)"; exit 1 ;;
|
|
esac
|
|
)
|
|
|
|
main "${@}"
|