#!/usr/bin/env sh # bin/install.sh — install userland CLI tools 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_ function, and call it at the bottom. 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)" # 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 } # 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 } install_ripgrep install_fd install_bat install_fzf install_jq fsay "Done. Tools in $BIN_DIR (added to PATH by zsh/zshrc)."