Add/update scripts for go tools

main
Buddy Sandidge 2 years ago
parent 914006283e
commit 9606935ba1

@ -119,6 +119,20 @@ extract_tarball () (
rm -rf "${tmp_dir}" rm -rf "${tmp_dir}"
) )
extract_binary () (
url=${1}
dest=${2}
sudo=${3:-}
if [ -f "${dest}" ]; then
return
fi
mkdir_if_missing "$(dirname "${dest}")" "${sudo}"
tmp_file="$(mktemp)"
curl --silent --location --output "${tmp_file}" "${url}"
$sudo chmod +x "${tmp_file}"
$sudo mv "${tmp_file}" "${dest}"
)
relative_path() ( relative_path() (
# both $1 and $2 are absolute paths beginning with / # both $1 and $2 are absolute paths beginning with /
# $1 must be a canonical path; that is none of its directory # $1 must be a canonical path; that is none of its directory

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1090
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
VERSION=${VERSION:-2.10.3}
DEST="${XDG_DATA_HOME}/apps/releases/protoc-grpc-gateway"
BASE_URL=https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${VERSION}
GRPC_GATEWAY_URL=${BASE_URL}/protoc-gen-grpc-gateway-v${VERSION}-$(get_os)-$(uname -m)
OPENAPI_V2_URL=${BASE_URL}/protoc-gen-openapiv2-v${VERSION}-$(get_os)-$(uname -m)
extract_binary "${GRPC_GATEWAY_URL}" "${DEST}/${VERSION}/protoc-gen-grpc-gateway"
extract_binary "${OPENAPI_V2_URL}" "${DEST}/${VERSION}/protoc-gen-openapiv2"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/protoc-gen-grpc-gateway" "${DEST}" protoc-gen-grpc-gateway
set_link "${XDG_BIN_HOME}/protoc-gen-openapiv2" "${DEST}" protoc-gen-openapiv2

@ -6,7 +6,7 @@ set -e
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=go APP=go
VERSION=${VERSION:-1.18.1} VERSION=${VERSION:-1.18.3}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
URL=https://dl.google.com/go/go${VERSION}.$(get_os)-$(get_arch).tar.gz URL=https://dl.google.com/go/go${VERSION}.$(get_os)-$(get_arch).tar.gz

@ -6,7 +6,7 @@ set -e
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=golangci-lint APP=golangci-lint
VERSION=${VERSION:-1.45.0} VERSION=${VERSION:-1.46.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
URL=https://github.com/golangci/golangci-lint/releases/download/v${VERSION}/golangci-lint-${VERSION}-$(get_os)-$(get_arch).tar.gz URL=https://github.com/golangci/golangci-lint/releases/download/v${VERSION}/golangci-lint-${VERSION}-$(get_os)-$(get_arch).tar.gz

@ -6,7 +6,7 @@ set -e
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=protoc-gen-go APP=protoc-gen-go
VERSION=${VERSION:-1.27.1} VERSION=${VERSION:-1.28.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
URL=https://github.com/protocolbuffers/protobuf-go/releases/download/v${VERSION}/protoc-gen-go.v${VERSION}.$(get_os).$(get_arch).tar.gz URL=https://github.com/protocolbuffers/protobuf-go/releases/download/v${VERSION}/protoc-gen-go.v${VERSION}.$(get_os).$(get_arch).tar.gz

@ -4,7 +4,7 @@
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=helm APP=helm
VERSION=${VERSION:-3.6.0} VERSION=${VERSION:-3.9.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
if [[ ! -d "${DEST}/${VERSION}" ]]; then if [[ ! -d "${DEST}/${VERSION}" ]]; then

@ -11,7 +11,7 @@ get_arch () (
) )
APP=dasel APP=dasel
VERSION=${VERSION:-1.24.3} VERSION=${VERSION:-1.25.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch) URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch)

@ -17,7 +17,7 @@ get_arch () (
uname -m uname -m
) )
VERSION=${VERSION:-3.19.4} VERSION=${VERSION:-21.2}
APP=protoc APP=protoc
APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP} APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP}
VER_DIR=${APPS_DIR}/${VERSION} VER_DIR=${APPS_DIR}/${VERSION}

@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
function get_os () (
case $(uname -s) in
Linux*) echo linux;;
Darwin*) echo darwin;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
)
function get_arch () (
case $(uname -m) in
x86_64) echo x64;;
arm64) echo arm64;;
aarch64) echo arm64;;
*) >&2 echo "unsupported arch: $(uname -m)"; exit 1;;
esac
)
APP=pulumi
VERSION=${VERSION:-3.35.2}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"
set_current_link "${DEST}" "${VERSION}"
for PULUMI_APP in $(find "${DEST}/${VERSION}" -type f -exec basename "{}" \; | sort); do
set_link "${XDG_BIN_HOME}/${PULUMI_APP}" "${DEST}" "${PULUMI_APP}"
done
Loading…
Cancel
Save