From 9606935ba138a67be88595026a7adab56580c09b Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Thu, 7 Jul 2022 17:23:40 -0700 Subject: [PATCH] Add/update scripts for go tools --- base/.local/share/buddy-up/includes/utils.sh | 14 ++++++++ go/.local/bin/install-go-grpc-gateway | 20 +++++++++++ go/.local/bin/install-go-home | 2 +- go/.local/bin/install-golangci-lint | 2 +- go/.local/bin/install-protobuf-go | 2 +- hellotech/.local/bin/install-helm-home | 2 +- install-scripts/.local/bin/install-dasel-home | 2 +- .../.local/bin/install-protoc-home | 2 +- install-scripts/.local/bin/install-pulumi | 34 +++++++++++++++++++ 9 files changed, 74 insertions(+), 6 deletions(-) create mode 100755 go/.local/bin/install-go-grpc-gateway create mode 100755 install-scripts/.local/bin/install-pulumi diff --git a/base/.local/share/buddy-up/includes/utils.sh b/base/.local/share/buddy-up/includes/utils.sh index 67df74c..b21b3d0 100644 --- a/base/.local/share/buddy-up/includes/utils.sh +++ b/base/.local/share/buddy-up/includes/utils.sh @@ -119,6 +119,20 @@ extract_tarball () ( 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() ( # both $1 and $2 are absolute paths beginning with / # $1 must be a canonical path; that is none of its directory diff --git a/go/.local/bin/install-go-grpc-gateway b/go/.local/bin/install-go-grpc-gateway new file mode 100755 index 0000000..2ea671a --- /dev/null +++ b/go/.local/bin/install-go-grpc-gateway @@ -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 diff --git a/go/.local/bin/install-go-home b/go/.local/bin/install-go-home index 5e062f9..41aaccd 100755 --- a/go/.local/bin/install-go-home +++ b/go/.local/bin/install-go-home @@ -6,7 +6,7 @@ set -e source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=go -VERSION=${VERSION:-1.18.1} +VERSION=${VERSION:-1.18.3} DEST="${XDG_DATA_HOME}/apps/releases/${APP}" URL=https://dl.google.com/go/go${VERSION}.$(get_os)-$(get_arch).tar.gz diff --git a/go/.local/bin/install-golangci-lint b/go/.local/bin/install-golangci-lint index 730654e..c046f29 100755 --- a/go/.local/bin/install-golangci-lint +++ b/go/.local/bin/install-golangci-lint @@ -6,7 +6,7 @@ set -e source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=golangci-lint -VERSION=${VERSION:-1.45.0} +VERSION=${VERSION:-1.46.0} 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 diff --git a/go/.local/bin/install-protobuf-go b/go/.local/bin/install-protobuf-go index 8811e87..b8f2220 100755 --- a/go/.local/bin/install-protobuf-go +++ b/go/.local/bin/install-protobuf-go @@ -6,7 +6,7 @@ set -e source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=protoc-gen-go -VERSION=${VERSION:-1.27.1} +VERSION=${VERSION:-1.28.0} 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 diff --git a/hellotech/.local/bin/install-helm-home b/hellotech/.local/bin/install-helm-home index bf6b961..d39b8bd 100755 --- a/hellotech/.local/bin/install-helm-home +++ b/hellotech/.local/bin/install-helm-home @@ -4,7 +4,7 @@ source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=helm -VERSION=${VERSION:-3.6.0} +VERSION=${VERSION:-3.9.0} DEST="${XDG_DATA_HOME}/apps/releases/${APP}" if [[ ! -d "${DEST}/${VERSION}" ]]; then diff --git a/install-scripts/.local/bin/install-dasel-home b/install-scripts/.local/bin/install-dasel-home index 3abffdb..e543a4e 100755 --- a/install-scripts/.local/bin/install-dasel-home +++ b/install-scripts/.local/bin/install-dasel-home @@ -11,7 +11,7 @@ get_arch () ( ) APP=dasel -VERSION=${VERSION:-1.24.3} +VERSION=${VERSION:-1.25.0} DEST=${XDG_DATA_HOME}/apps/releases/${APP} URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch) diff --git a/install-scripts/.local/bin/install-protoc-home b/install-scripts/.local/bin/install-protoc-home index 9af428f..b1d3ffa 100755 --- a/install-scripts/.local/bin/install-protoc-home +++ b/install-scripts/.local/bin/install-protoc-home @@ -17,7 +17,7 @@ get_arch () ( uname -m ) -VERSION=${VERSION:-3.19.4} +VERSION=${VERSION:-21.2} APP=protoc APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP} VER_DIR=${APPS_DIR}/${VERSION} diff --git a/install-scripts/.local/bin/install-pulumi b/install-scripts/.local/bin/install-pulumi new file mode 100755 index 0000000..84a2369 --- /dev/null +++ b/install-scripts/.local/bin/install-pulumi @@ -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