dot-files/dot_local/bin/executable_install-protoc-home
Buddy 674ed2d739 Bump pinned versions in install scripts via scripts/update-versions
Includes the manual protoc-system/minikube-system URL fixes and the
bat-extras EXTRA_FILE companion bump found while reviewing the run.
2026-09-13 22:26:04 -07:00

43 lines
882 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=protoc
VERSION=${VERSION:-34.2}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-$(get_os)-$(get_arch).zip
XDG_INCLUDE_HOME="${XDG_INCLUDE_HOME:=$HOME/.local/include}"
mkdir_if_missing "${XDG_INCLUDE_HOME}"
extract_zip "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "bin/${APP}"
set_link "${XDG_INCLUDE_HOME}/google" "${DEST}" include/google
)
get_os() (
case $(uname -s) in
Linux*) echo linux ;;
Darwin*) echo osx ;;
*)
echo >&2 "unsupported os"
exit 1
;;
esac
)
get_arch() (
ARCH=$(uname -m)
if [[ $ARCH == arm64 ]]; then
ARCH=aarch_64
fi
echo "$ARCH"
)
main