Files
dotfiles/bin/install.sh
T
noconnorandClaude Opus 4.8 3751836c5c docker/: install rootful Docker; gate kind on it
kind never worked reliably against rootless Docker on Kasm, even with the
cgroup delegation from docker-rootless-cgroup/. So install full Docker
where we can, and flip bin/'s kind gate from "rootless is available" to
"a rootful daemon answers" — kind is simply skipped on Kasm now.

docker/install.sh no-ops when a rootless daemon is already running so it
never fights Kasm's setup. It runs before bin/ in bootstrap so the kind
gate can see the daemon it just started. zsh/zshrc re-execs via newgrp
when the account gained the docker group but the live shell predates it.

docker-rootless-cgroup/ keeps its delegation (still useful for
per-container resource limits); only its kind-centric comments change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 04:39:58 -04:00

168 lines
5.7 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
# docker_full_available — true only if a non-rootless (full) Docker daemon is
# up and reachable. kind needs full Docker: we could not get it working against
# rootless Docker on Kasm, so it is only worth installing where a rootful
# daemon answers. SecurityOptions lists name=rootless under rootless mode.
docker_full_available() {
command -v docker >/dev/null 2>&1 || return 1
_secopts="$(docker info -f '{{println .SecurityOptions}}' 2>/dev/null)" || return 1
[ -n "$_secopts" ] || return 1
! printf '%s' "$_secopts" | grep -q 'name=rootless'
}
# 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"
}
# kind — run local Kubernetes clusters in Docker (single static binary). Gated
# on full (non-rootless) Docker at the call site: kind could not be made to
# work against rootless Docker on Kasm, so it is skipped there.
install_kind() {
ver=v0.32.0
have_version kind "$ver" && { fsay "kind $ver already installed."; return 0; }
install_raw_bin \
"https://github.com/kubernetes-sigs/kind/releases/download/$ver/kind-linux-$DEB" kind
mark_version kind "$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"
}
# task — go-task, the Taskfile.yml task runner. Binary is at the archive root.
install_task() {
ver=v3.52.0
have_version task "$ver" && { fsay "task $ver already installed."; return 0; }
install_tarball_bin \
"https://github.com/go-task/task/releases/download/$ver/task_linux_$DEB.tar.gz" \
task task
mark_version task "$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
if docker_full_available; then
install_kind
else
fsay "Skipping kind: full (non-rootless) Docker not available."
fi
install_kubectx
install_kubens
install_stern
install_yq
install_tofu
install_task
install_terragrunt
fsay "Done. Tools in $BIN_DIR (added to PATH by zsh/zshrc)."