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>
This commit is contained in:
+106
-60
@@ -1,11 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
# bin/install.sh — install userland CLI tools into ~/.local/bin.
|
||||
# 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 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.
|
||||
# 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)"
|
||||
@@ -14,70 +17,113 @@ REPO_ROOT="$(dirname -- "$SCRIPT_DIR")"
|
||||
# shellcheck source=../lib/fetch.sh
|
||||
. "$REPO_ROOT/lib/fetch.sh"
|
||||
|
||||
ARCH="$(fetch_arch)"
|
||||
|
||||
# ripgrep — fast recursive search. x86_64 ships musl (static); aarch64 gnu.
|
||||
install_ripgrep() {
|
||||
ver=15.1.0
|
||||
have_version rg "$ver" && { fsay "ripgrep $ver already installed."; return 0; }
|
||||
case "$ARCH" in
|
||||
x86_64) triple=x86_64-unknown-linux-musl ;;
|
||||
aarch64) triple=aarch64-unknown-linux-gnu ;;
|
||||
esac
|
||||
install_tarball_bin \
|
||||
"https://github.com/BurntSushi/ripgrep/releases/download/$ver/ripgrep-$ver-$triple.tar.gz" \
|
||||
"ripgrep-$ver-$triple/rg" rg
|
||||
}
|
||||
|
||||
# fd — fast, user-friendly find. musl (static) on both arches.
|
||||
install_fd() {
|
||||
ver=10.4.2
|
||||
have_version fd "$ver" && { fsay "fd $ver already installed."; return 0; }
|
||||
triple="$ARCH-unknown-linux-musl"
|
||||
install_tarball_bin \
|
||||
"https://github.com/sharkdp/fd/releases/download/v$ver/fd-v$ver-$triple.tar.gz" \
|
||||
"fd-v$ver-$triple/fd" fd
|
||||
}
|
||||
|
||||
# bat — cat with syntax highlighting. musl (static) on both arches.
|
||||
install_bat() {
|
||||
ver=0.26.1
|
||||
have_version bat "$ver" && { fsay "bat $ver already installed."; return 0; }
|
||||
triple="$ARCH-unknown-linux-musl"
|
||||
install_tarball_bin \
|
||||
"https://github.com/sharkdp/bat/releases/download/v$ver/bat-v$ver-$triple.tar.gz" \
|
||||
"bat-v$ver-$triple/bat" bat
|
||||
}
|
||||
|
||||
# fzf — general-purpose fuzzy finder (static Go binary).
|
||||
install_fzf() {
|
||||
ver=0.74.0
|
||||
have_version fzf "$ver" && { fsay "fzf $ver already installed."; return 0; }
|
||||
case "$ARCH" in
|
||||
x86_64) a=amd64 ;;
|
||||
aarch64) a=arm64 ;;
|
||||
esac
|
||||
install_tarball_bin \
|
||||
"https://github.com/junegunn/fzf/releases/download/v$ver/fzf-$ver-linux_$a.tar.gz" \
|
||||
fzf fzf
|
||||
}
|
||||
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; }
|
||||
case "$ARCH" in
|
||||
x86_64) a=amd64 ;;
|
||||
aarch64) a=arm64 ;;
|
||||
esac
|
||||
install_raw_bin \
|
||||
"https://github.com/jqlang/jq/releases/download/jq-$ver/jq-linux-$a" jq
|
||||
"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_ripgrep
|
||||
install_fd
|
||||
install_bat
|
||||
install_fzf
|
||||
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)."
|
||||
|
||||
Reference in New Issue
Block a user