Files
dotfiles/bin/install.sh
T
noconnorandClaude Opus 4.8 ebdc213444 bin/: swap seed tools for devops CLIs; add ansible/ module
Replace the placeholder ripgrep/fd/bat/fzf set with devops tooling, keeping
jq: kubectl, helm, k9s, kubectx/kubens, stern, yq, OpenTofu, and terragrunt
— all self-contained, statically linked release binaries in ~/.local/bin,
so they persist across Kasm redeploys with no reinstall.

Switch idempotency from parsing each tool's --version (kubectl/helm/k9s have
no uniform flag) to a version stamp under ~/.local/bin/.versions, and add
fetch_arch_deb() for the amd64/arm64 naming most devops tools use.

Ansible is Python, not a single binary, so it gets its own module: a venv at
~/.local/opt/ansible with its CLIs symlinked into ~/.local/bin. The guard
verifies ansible actually runs (a redeploy can wipe the system python the
venv links to) and rebuilds if not.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 10:34:01 -04:00

130 lines
4.2 KiB
Bash
Executable File

#!/usr/bin/env sh
# bin/install.sh — install userland devops CLIs into ~/.local/bin.
#
# Every tool is a self-contained release binary downloaded from upstream and
# dropped into ~/.local/bin (no sudo, nothing outside $HOME), so it persists
# across Kasm redeploys. Idempotent: each tool records its version under
# ~/.local/bin/.versions and is skipped when the pinned version is already
# installed. To add a tool, pin a version, add an install_<name> function,
# and call it at the bottom.
#
# Ansible is not a single binary; it is handled separately in ansible/.
set -eu
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
REPO_ROOT="$(dirname -- "$SCRIPT_DIR")"
# shellcheck source=../lib/fetch.sh
. "$REPO_ROOT/lib/fetch.sh"
ARCH="$(fetch_arch)" # x86_64 / aarch64
DEB="$(fetch_arch_deb)" # amd64 / arm64
# jq — command-line JSON processor (single static binary).
install_jq() {
ver=1.8.2
have_version jq "$ver" && { fsay "jq $ver already installed."; return 0; }
install_raw_bin \
"https://github.com/jqlang/jq/releases/download/jq-$ver/jq-linux-$DEB" jq
mark_version jq "$ver"
}
# kubectl — Kubernetes CLI (single static binary from dl.k8s.io).
install_kubectl() {
ver=v1.36.2
have_version kubectl "$ver" && { fsay "kubectl $ver already installed."; return 0; }
install_raw_bin \
"https://dl.k8s.io/release/$ver/bin/linux/$DEB/kubectl" kubectl
mark_version kubectl "$ver"
}
# helm — Kubernetes package manager (from get.helm.sh).
install_helm() {
ver=v4.2.2
have_version helm "$ver" && { fsay "helm $ver already installed."; return 0; }
install_tarball_bin \
"https://get.helm.sh/helm-$ver-linux-$DEB.tar.gz" \
"linux-$DEB/helm" helm
mark_version helm "$ver"
}
# k9s — terminal UI for Kubernetes clusters. Asset uses capital "Linux".
install_k9s() {
ver=v0.51.0
have_version k9s "$ver" && { fsay "k9s $ver already installed."; return 0; }
install_tarball_bin \
"https://github.com/derailed/k9s/releases/download/$ver/k9s_Linux_$DEB.tar.gz" \
k9s k9s
mark_version k9s "$ver"
}
# kubectx / kubens — fast context and namespace switching. Uses x86_64 token.
install_kubectx() {
ver=v0.11.0
have_version kubectx "$ver" && { fsay "kubectx $ver already installed."; return 0; }
install_tarball_bin \
"https://github.com/ahmetb/kubectx/releases/download/$ver/kubectx_${ver}_linux_$ARCH.tar.gz" \
kubectx kubectx
mark_version kubectx "$ver"
}
install_kubens() {
ver=v0.11.0
have_version kubens "$ver" && { fsay "kubens $ver already installed."; return 0; }
install_tarball_bin \
"https://github.com/ahmetb/kubectx/releases/download/$ver/kubens_${ver}_linux_$ARCH.tar.gz" \
kubens kubens
mark_version kubens "$ver"
}
# stern — multi-pod log tailing. Release tag is vX but asset drops the v.
install_stern() {
ver=1.34.0
have_version stern "$ver" && { fsay "stern $ver already installed."; return 0; }
install_tarball_bin \
"https://github.com/stern/stern/releases/download/v$ver/stern_${ver}_linux_$DEB.tar.gz" \
stern stern
mark_version stern "$ver"
}
# yq — YAML/JSON/XML processor (single static binary).
install_yq() {
ver=v4.53.3
have_version yq "$ver" && { fsay "yq $ver already installed."; return 0; }
install_raw_bin \
"https://github.com/mikefarah/yq/releases/download/$ver/yq_linux_$DEB" yq
mark_version yq "$ver"
}
# OpenTofu — open-source Terraform. Asset drops the leading v.
install_tofu() {
ver=1.12.3
have_version tofu "$ver" && { fsay "tofu $ver already installed."; return 0; }
install_tarball_bin \
"https://github.com/opentofu/opentofu/releases/download/v$ver/tofu_${ver}_linux_$DEB.tar.gz" \
tofu tofu
mark_version tofu "$ver"
}
# terragrunt — thin wrapper around tofu/terraform (single static binary).
install_terragrunt() {
ver=v1.1.0
have_version terragrunt "$ver" && { fsay "terragrunt $ver already installed."; return 0; }
install_raw_bin \
"https://github.com/gruntwork-io/terragrunt/releases/download/$ver/terragrunt_linux_$DEB" \
terragrunt
mark_version terragrunt "$ver"
}
install_jq
install_kubectl
install_helm
install_k9s
install_kubectx
install_kubens
install_stern
install_yq
install_tofu
install_terragrunt
fsay "Done. Tools in $BIN_DIR (added to PATH by zsh/zshrc)."