diff --git a/.tests/fakebin/_curl b/.tests/fakebin/_curl index 3b00f1d..f57ee59 100644 --- a/.tests/fakebin/_curl +++ b/.tests/fakebin/_curl @@ -8,7 +8,8 @@ # FAKE_BOOT_PW the password that gets a 200; anything else gets a 401 # FAKE_BOOT_CODE force a code (404, 000, 500 ...) whatever the password # FAKE_BWS_SUMS match (default) | mismatch | absent -# FAKE_FAIL=curl:deb | curl:chezmoi | curl:fzf | curl:docker +# FAKE_FAIL=curl:deb | curl:chezmoi | curl:fzf | curl:docker | curl:claude +# | curl:rustup | curl:font | curl:claude-desktop # fail just that one download _fb=$(dirname "$0") # the fakebin directory @@ -57,6 +58,28 @@ case $url in # FAKE_FAIL=curl:docker is that download failing. [ "$mode" = docker ] && exit 22 installer docker "\$HOME/.local/bin" | emit; exit 0 ;; +# Claude Code's native installer and rustup-init, both downloaded to a file +# and run from it, the docker shape. Each stand-in drops the fake of the same +# name where the real one would put it, so the post-install `have` is real. +https://claude.ai/install.sh) + [ "$mode" = claude ] && exit 22 + installer claude "\$HOME/.local/bin" | emit; exit 0 ;; +https://sh.rustup.rs) + [ "$mode" = rustup ] && exit 22 + installer rustup "\${CARGO_HOME:-\$HOME/.cargo}/bin" | emit; exit 0 ;; +# The Claude Desktop apt repository's signing key. Its fingerprint is what the +# fake gpg reports, so the key's content here does not matter -- only that it +# arrived. +https://downloads.claude.ai/claude-desktop/key.asc) + [ "$mode" = claude-desktop ] && exit 22 + printf -- '-----BEGIN PGP PUBLIC KEY BLOCK-----\nfake\n' | emit; exit 0 ;; +# A Nerd Fonts release: a real .tar.xz holding one .ttf named for the family, +# so the extract and the "already installed" probe both have something to see. +https://github.com/ryanoasis/nerd-fonts/releases/latest/download/*.tar.xz) + [ "$mode" = font ] && exit 22 + f=${url##*/}; f=${f%.tar.xz} + d=$(mktemp -d); : > "$d/${f}NerdFont-Regular.ttf" + tar -cJf - -C "$d" . | emit; rm -rf "$d"; exit 0 ;; *go.dev/VERSION*) echo go1.99.0; exit 0 ;; *api.github.com*) diff --git a/.tests/fakebin/_fake b/.tests/fakebin/_fake index 4211c6f..4087af4 100755 --- a/.tests/fakebin/_fake +++ b/.tests/fakebin/_fake @@ -123,6 +123,25 @@ chezmoi) mkdir -p "$src/.git" && : > "$src/.git/config" && : > "$src/README" || exit 1 exit 0 ;; curl) . "$(dirname "$0")/_curl" ;; +gpg) + # `gpg --show-keys --with-colons KEY`: one fpr record. FAKE_GPG_FPR stands in + # for a key that is not the one Anthropic publishes. + printf 'pub:-:4096:1:BAA929FF1A7ECACE:0:::-:::scESC::::::23::0:\n' + printf 'fpr:::::::::%s:\n' "${FAKE_GPG_FPR:-31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE}" + exit 0 ;; +go) + # `go env GOBIN` is empty and GOPATH is ~/go, which is the stock layout. + # `go install MOD@latest` drops a fake of the module's last segment in + # ~/go/bin, so a second run can see it. FAKE_FAIL=go:install fails them. + case ${1:-} in + env) case ${2:-} in GOPATH) echo "$HOME/go" ;; esac; exit 0 ;; + install) + [ "$mode" = install ] && exit 1 + t=${2%@*}; t=${t##*/} + mkdir -p "$HOME/go/bin" && ln -sf "$(dirname "$0")/_fake" "$HOME/go/bin/$t" + exit 0 ;; + esac + exit 0 ;; fzf) # The picker's own fzf, and the only fake here whose ARGV is the thing # under test. `--bind` strings are built across a dozen continued lines, so diff --git a/.tests/seal.sh b/.tests/seal.sh index 7c77625..f8cc3df 100755 --- a/.tests/seal.sh +++ b/.tests/seal.sh @@ -30,17 +30,21 @@ set -eu # "gzip: not found" -- which is the seal working, and is how it was found. REAL='sh awk grep sed sort cut tr head tail id uname mkdir cp mv rm cat dirname basename chmod mktemp find install sha256sum stty tar gzip ln - touch true false env expr wc stat' + touch true false env expr wc stat bash xz' # Deliberately NOT here by default, each for a reason a test depends on: # sudo absent means SUDO='' and apt-get is invoked directly, which is the # only way FAKE_FAIL=apt-get can reach the installer at all. # fzf absent is what makes ensure_fzf actually fetch one. # bws absent is what makes the private tier actually install it. FAKE='curl apt-get apt-cache brew npm uv snap flatpak xcode-select - git dpkg unzip chezmoi' + git dpkg unzip chezmoi gpg' # docker absent is what makes the docker rows actually run get.docker.com; # the fake the script drops behaves like every other one here. -OPTIONAL='sudo fzf bws nvim go node docker' +# claude, rustup, claude-desktop +# absent is what makes those script rows actually run; the +# installers they fetch drop fakes like every other one here. +# fc-cache absent is a fresh container; the font rows say so and carry on. +OPTIONAL='sudo fzf bws nvim go node docker claude rustup claude-desktop fc-cache' dir=${1:?usage: seal.sh [--with name ...] [--without name ...]}; shift # Everything the seal KNOWS about, fixed before --without takes anything out: a diff --git a/.tests/test.sh b/.tests/test.sh index dc85093..9d7ddc6 100755 --- a/.tests/test.sh +++ b/.tests/test.sh @@ -23,7 +23,7 @@ if [ "${1:-}" = "--docker" ]; then # behaviour is the one property that must hold on the older release. exec docker run --rm -v "$(cd .. && pwd):/w:ro" "${DOTUP_TEST_IMAGE:-ubuntu:24.04}" sh -c ' apt-get update -qq - apt-get install -y -qq fzf curl ca-certificates >/dev/null 2>&1 + apt-get install -y -qq fzf curl ca-certificates xz-utils >/dev/null 2>&1 cp -r /w /work && cd /work/.tests && rm -rf state fzfver echo " distro fzf: $(fzf --version 2>/dev/null || echo none)" sh ../dot_local/bin/executable_dotup preflight # exactly what a real run does first @@ -72,7 +72,16 @@ SEALSUDO=${TMPDIR:-/tmp}/dotup-seal-sudo.$$ sh ./seal.sh "$SEAL" >/dev/null sh ./seal.sh "$SEALSUDO" --with sudo >/dev/null BOXN=0; SB=; LOG=; BOXENV=; BOXPATH=$SEAL; PW= -cleanup_boxes() { rm -rf "$SEAL" "$SEALSUDO" ${TMPDIR:-/tmp}/dotup-box."$$".* \ +# agents/specify-cli was the manifest's only uv row, and it is gone: broken on +# dev and unused. The uv CHANNEL stays -- it is a channel, not a package -- so +# its tests run against the real manifest plus one fixture row, inserted beside +# the agents it would belong with so the group stays one contiguous run. +UVM=${TMPDIR:-/tmp}/dotup-uvm.$$ +awk -F'\t' '{ print } + $1=="agents" && $2=="herdr" { + print "@needs\tagents/uv-fixture\tcore/uv" + print "agents\tuv-fixture\tsafe\t-uv\t-uv\tfixture for the uv channel" }' "$M" > "$UVM" +cleanup_boxes() { rm -rf "$SEAL" "$SEALSUDO" "$UVM" ${TMPDIR:-/tmp}/dotup-box."$$".* \ ${TMPDIR:-/tmp}/dotup-sealtest."$$" ; } trap cleanup_boxes EXIT INT TERM @@ -146,8 +155,20 @@ is "group count unchanged by directives" "11" \ # @spec is the second directive kind and must be as invisible as the first. is "@spec lines are not packages" "0" \ "$(sh $D render | cut -f2 | grep -c 'spec' || true)" -reset; sh $D toggle p:core/uv >/dev/null -is "dropping uv drops specify-cli" "off" "$(on agents/specify-cli)" +rm -rf state; DOTUP_MANIFEST=$UVM sh $D preset defaults +is "control: a uv tool is in the defaults" "on" "$(on agents/uv-fixture)" +DOTUP_MANIFEST=$UVM sh $D toggle p:core/uv >/dev/null +is "dropping uv drops the uv tools" "off" "$(on agents/uv-fixture)" +reset +# The brew-only rows. Without core/brew they have no source on a Linux box, so +# the closure has to carry it: the precedent lazygit, omp and herdr set. +for k in agents/beads core/tea core/bun; do + reset; sh $D toggle p:core/brew >/dev/null + is "dropping brew drops $k" "off" "$(on $k)" +done +# go-tools is `go install`; without a go there is nothing to run it. +reset; sh $D toggle p:core/go >/dev/null +is "dropping go drops go-tools" "off" "$(on core/go-tools)" # bws-secrets promised seven API keys and installed nothing to fetch them with. # The binary ships as a .zip and 24.04 minimal has no unzip, so the dependency # is real rather than decorative. @@ -414,6 +435,42 @@ is "…and compose, which is the plugin" "script docker-compose" "$(rs doc is "the qemu guest agent is an apt row" "apt qemu-guest-agent" "$(rs virt/guest-agent)" is "…and the spice agent beside it" "apt spice-vdagent" "$(rs virt/spice-vdagent)" is "an unknown key says so" "missing" "$(rs nope/nope | tr -d ' ')" +# The rows a new laptop was missing (audit C, G-pkg-1..9; audit B, G-AG-9). +is "claude code is a script row" "script claude" "$(rs agents/claude)" +is "beads comes from brew, apt has none" "brew beads" "$(rs agents/beads)" +is "jq is a plain apt row" "apt jq" "$(rs core/jq)" +is "shellcheck is a plain apt row" "apt shellcheck" "$(rs core/shellcheck)" +is "clang-format is a plain apt row" "apt clang-format" "$(rs core/clang-format)" +is "gitleaks is a plain apt row" "apt gitleaks" "$(rs core/gitleaks)" +is "tea falls through to brew" "brew tea" "$(rs core/tea)" +is "bun falls through to its tap" "brew oven-sh/bun/bun" "$(rs core/bun)" +is "go tools have a channel of their own" "go go-tools" "$(rs core/go-tools)" +is "rust is a script row" "script rust" "$(rs core/rust)" +is "incus is an apt row" "apt incus" "$(rs virt/incus)" +is "claude desktop configures its own repo" "script claude-desktop" "$(rs apps/claude-desktop)" +is "signal is a flathub app id" "flatpak org.signal.Signal" "$(rs apps/signal)" +# fonts-powerline is the Powerline glyphs alone, not a Nerd Font: the prompt and +# nvim's icons drew as tofu on every fresh Linux box. +is "a Nerd Font is the release, not fonts-powerline" "tarball hack-nerd-font" "$(rs fonts/hack-nerd-font)" +is "…both of them" "tarball iosevka-nerd-font" "$(rs fonts/iosevka-nerd-font)" +is "no row names fonts-powerline any more" "" \ + "$(awk -F'\t' '!/^[#@]/ && NF>=3 && ($4=="fonts-powerline" || $5=="fonts-powerline")' "$M")" +# specify-cli was broken on dev and unused; DECISIONS dropped it. +is "specify-cli is gone" "missing" "$(rs agents/specify-cli | tr -d ' ')" +is "…with its directives" "" \ + "$(grep 'specify' "$M" || true)" +# Two plugins dev runs that the spec did not list. +has "the pi plugin spec carries pi-lens" " pi-lens" "$(rs agents/pi-plugins)" +has "…and pi-mcp-adapter" " pi-mcp-adapter" "$(rs agents/pi-plugins)" +# The flag is the safety story: incus is a daemon whose group is root-equivalent, +# the two apps are gui. None of them is ticked on a headless box. +fl() { awk -F'\t' -v k="$1" '!/^[#@]/ && NF>=3 && $1"/"$2==k {print $3}' "$M"; } +is "incus is invasive" "invasive" "$(fl virt/incus)" +is "claude desktop is gui" "gui" "$(fl apps/claude-desktop)" +is "signal is gui" "gui" "$(fl apps/signal)" +reset +is "…so the headless defaults tick none of them" "off off off" \ + "$(on virt/incus) $(on apps/claude-desktop) $(on apps/signal)" # The macOS half of the manifest is exercised nowhere else. Resolution is pure # data, so a fake `uname` is enough to check it — and it caught a real bug: the # apt/brew fallback used to run both ways, so a Linux-only package resolved to @@ -427,6 +484,14 @@ is "darwin: no apt package is not a reason to try apt" "unavailable" \ # Docker Desktop's own CLI installer, off the .dmg. There is no brew cask in # this story on either platform. is "darwin: docker is a script row too" "script docker-ce" "$(drs docker/docker-ce)" +is "darwin: claude code is the same script" "script claude" "$(drs agents/claude)" +is "darwin: go tools are the same channel" "go go-tools" "$(drs core/go-tools)" +is "darwin: rust is the same script" "script rust" "$(drs core/rust)" +is "darwin: fonts stay brew casks" "brew font-hack-nerd-font" "$(drs fonts/hack-nerd-font)" +is "darwin: claude desktop is the cask" "brew claude" "$(drs apps/claude-desktop)" +is "darwin: signal is the cask" "brew signal" "$(drs apps/signal)" +is "darwin: bun is the tap" "brew oven-sh/bun/bun" "$(drs core/bun)" +is "darwin: incus has no source" "unavailable" "$(drs virt/incus | tr -d ' ')" # Nothing in the default set may be unresolvable — that is a manifest bug, and # it is silent until someone runs the installer on a fresh machine. @@ -470,7 +535,8 @@ hasnt "--print never reaches the private stage" "Bootstrap URL:" "$out" # channel. Deliberately not the whole default set: the tarball and script # handlers write outside $HOME, and a test suite has no business doing that. newbox; BOXPATH=$SEALSUDO -pick agents/omp agents/specify-cli apps/obsidian core/bitwarden-cli \ +BOXENV="DOTUP_MANIFEST=$UVM" +pick agents/omp agents/uv-fixture apps/obsidian core/bitwarden-cli \ core/gh core/lazygit core/mermaid-cli core/ripgrep gpu/container-toolkit box install >/dev/null 2>&1 || true log=$(cat "$LOG") @@ -478,7 +544,7 @@ has "apt batches its packages in one call" "apt-get install -y ripgrep" has "brew gets the tap-only package" "brew install can1357/tap/omp" "$log" has "brew gets the apt-less package" "brew install lazygit" "$log" has "npm gets the scoped spec" "@mermaid-js/mermaid-cli" "$log" -has "uv installs the tool, not the package" "uv tool install specify-cli" "$log" +has "uv installs the tool, not the package" "uv tool install uv-fixture" "$log" has "snap gets the renamed binary" "snap install bw" "$log" has "flatpak gets the app id" "flatpak install" "$log" has "…with the real obsidian app id" "md.obsidian.Obsidian" "$log" @@ -605,6 +671,133 @@ else printf ' \033[33mskip\033[0m docker sits at an absolute path find_tool probes\n' fi +printf '\n\033[1mvendor scripts are downloaded, checked, then run — never piped\033[0m\n' +# Claude Code and rustup, the docker shape: fetched into this run's private +# directory, `[ -s ]` before anything runs it, then run from the file. Neither +# runs as root -- both are per-user installs. +for spec in "agents/claude claude https://claude.ai/install.sh bash claude-install.sh" \ + "core/rust rustup https://sh.rustup.rs sh rustup-init.sh"; do + set -- $spec; k=$1; bin=$2; url=$3; shl=$4; file=$5 + newbox + if holed "$bin"; then + pick "$k" + dry=$(box --print install 2>&1 | plain || true) + dl=$(printf '%s\n' "$dry" | sed -n "s|.*curl .*$url -o '\([^']*$file\)'.*|\1|p" | head -1) + has "$k: downloads to this run's own directory" "$SB/tmp/dotup." "$dl" + has "…checks it arrived non-empty" "[ -s '$dl' ]" "$dry" + has "…and runs that file" "$shl '$dl'" "$dry" + is "…never piping the download into a shell" "" \ + "$(grep -nE "curl[^|]*${url#https://}[^|]*\|" $D || true)" + box install >/dev/null 2>&1 || true + is "$k: the real run fetches it once" "1" "$(grep -c "curl.*$url" "$LOG" || true)" + is "…and never through sudo" "" \ + "$(grep -nE "SUDO[^\"]*$file|$file[^\"]*SUDO" $D || true)" + out=$(box install 2>&1 | plain || true) + has "…and a second run leaves it alone" "already present" "$out" + is "…downloading nothing the second time" "1" "$(grep -c "curl.*$url" "$LOG" || true)" + newbox; holed "$bin" || : + BOXENV="FAKE_FAIL=curl:$bin"; pick "$k" + out=$(box install 2>&1 | plain || true) + has "$k: a failed download is reported against the key" "$k: " "$out" + is "…and nothing is run in its place" "" \ + "$(printf '%s\n' "$out" | grep "$shl '" || true)" + is "…and the run exits non-zero" "1" "$(boxrc install)" + else + printf ' \033[33mskip\033[0m %s sits at an absolute path find_tool probes\n' "$bin" + fi +done +set -- +has "rustup leaves the shell files to chezmoi" "-y --no-modify-path" \ + "$(grep 'rustup-init.sh.*-y' $D)" + +printf '\n\033[1mNerd Fonts are the release, per user, not fonts-powerline\033[0m\n' +newbox; BOXPATH=$SEALSUDO; pick fonts/hack-nerd-font fonts/iosevka-nerd-font +box install >/dev/null 2>&1 || true +is "both fonts land in the user's font directory" "2" \ + "$(find "$SB/.local/share/fonts/NerdFonts" -name '*NerdFont-Regular.ttf' 2>/dev/null | wc -l | tr -d ' ')" +has "…from the Nerd Fonts release" "ryanoasis/nerd-fonts/releases/latest/download/Hack.tar.xz" "$(cat "$LOG")" +hasnt "…with no root and no package manager" "apt-get" "$(cat "$LOG")" +hasnt "…not even sudo" "sudo" "$(cat "$LOG")" +out=$(box install 2>&1 | plain || true) +has "a second run leaves an installed font alone" "Nerd Font already in" "$out" +is "…and downloads nothing" "2" "$(grep -c 'nerd-fonts/releases' "$LOG" || true)" +reset; sh $D toggle p:core/xz >/dev/null +is "dropping xz drops the font rows" "off off" "$(on fonts/hack-nerd-font) $(on fonts/iosevka-nerd-font)" +newbox; BOXENV='FAKE_FAIL=curl:font'; pick fonts/hack-nerd-font +out=$(box install 2>&1 | plain || true) +has "a failed font download is named" "fonts/hack-nerd-font: font download failed" "$out" +is "…and the run exits non-zero" "1" "$(boxrc install)" + +printf '\n\033[1mgo tools install after go, into GOPATH/bin\033[0m\n' +# The order is the whole point of the channel: `go install` before core/go's +# tarball has unpacked would be "go: not found" on every fresh box. +newbox; pick core/go core/go-tools +dry=$(box --print install 2>&1 | plain || true) +is "the go tarball is unpacked before any go install" "yes" \ + "$(a=$(printf '%s\n' "$dry" | grep -n 'go.tgz.*-C /usr/local' | head -1 | cut -d: -f1) + b=$(printf '%s\n' "$dry" | grep -n ' install golang.org/x/tools/gopls@latest' | head -1 | cut -d: -f1) + [ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")" +for gm in golang.org/x/tools/gopls golang.org/x/tools/cmd/goimports \ + github.com/golangci/golangci-lint/v2/cmd/golangci-lint honnef.co/go/tools/cmd/staticcheck; do + has "…and installs ${gm##*/}" "install $gm@latest" "$dry" +done +newbox; sh ./seal.sh "$SB/seal" --with go >/dev/null; BOXPATH=$SB/seal +pick core/go-tools +box install >/dev/null 2>&1 || true +is "a real run installs all four" "4" "$(grep -c '^go install .*@latest' "$LOG" || true)" +is "…into ~/go/bin" "4" "$(ls "$SB/go/bin" 2>/dev/null | wc -l | tr -d ' ')" +out=$(box install 2>&1 | plain || true) +has "a second run leaves them alone" "gopls already present" "$out" +is "…building nothing the second time" "4" "$(grep -c '^go install .*@latest' "$LOG" || true)" +newbox; sh ./seal.sh "$SB/seal" --with go >/dev/null; BOXPATH=$SB/seal +BOXENV='FAKE_FAIL=go:install'; pick core/go-tools +out=$(box install 2>&1 | plain || true) +has "a failed go install is named" "core/go-tools: go install staticcheck failed" "$out" +is "…and the run exits non-zero" "1" "$(boxrc install)" +newbox +if holed go; then + pick core/go-tools + has "with no go at all it says so" "go missing — core/go did not install" "$(box install 2>&1 | plain || true)" +else + printf ' \033[33mskip\033[0m go sits at an absolute path find_tool probes\n' +fi + +printf '\n\033[1mclaude desktop trusts only Anthropic'"'"'s key\033[0m\n' +# A vendor apt repository is a key apt will trust for root-installed packages, +# so the key is checked against the published fingerprint before it is placed. +# The happy path is read off the dry run, which prints exactly what a real run +# executes: the suite's own container runs as root, where $SUDO is empty and a +# real run would write /usr/share/keyrings for real. The refusal paths below run +# for real, because each stops before anything is written. +newbox; BOXPATH=$SEALSUDO; pick apps/claude-desktop +dry=$(box --print install 2>&1 | plain || true) +has "it fetches the signing key" "curl -fsSL https://downloads.claude.ai/claude-desktop/key.asc" "$dry" +has "…checks it against the published fingerprint" "31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE" "$dry" +has "…places it where the source line says" "/usr/share/keyrings/claude-desktop-archive-keyring.asc" "$dry" +has "…adds the repository" "/etc/apt/sources.list.d/claude-desktop.list" "$dry" +is "…refreshes apt after adding it" "yes" \ + "$(a=$(printf '%s\n' "$dry" | grep -n 'sources.list.d/claude-desktop.list$' | head -1 | cut -d: -f1) + b=$(printf '%s\n' "$dry" | grep -n 'apt-get update' | tail -1 | cut -d: -f1) + [ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")" +has "…then installs the package" "apt-get install -y claude-desktop" "$dry" +newbox; BOXPATH=$SEALSUDO; BOXENV='FAKE_GPG_FPR=0000000000000000000000000000000000000000' +pick apps/claude-desktop +out=$(box install 2>&1 | plain || true) +has "a key with the wrong fingerprint is refused" "fingerprint is not Anthropic's" "$out" +has "…after gpg read the key it downloaded" "gpg --show-keys --with-colons $SB/tmp/dotup." "$(cat "$LOG")" +hasnt "…and never placed" "claude-desktop-archive-keyring" "$(cat "$LOG")" +hasnt "…nor the repository added" "sources.list.d" "$(cat "$LOG")" +is "…and the run exits non-zero" "1" "$(boxrc install)" +newbox +if holed gpg; then + BOXPATH=$SB/seal; pick apps/claude-desktop + out=$(box install 2>&1 | plain || true) + has "with no gpg the key is not trusted on faith" "gpg is needed" "$out" + is "…and nothing is downloaded" "" "$(grep 'claude-desktop/key.asc' "$LOG" || true)" +else + printf ' \033[33mskip\033[0m gpg sits at an absolute path find_tool probes\n' +fi + printf '\n\033[1munattended — the boundary holds because of what is missing\033[0m\n' # A stale state file is the adversary here: it ticks the two things an # unattended run must never act on, and the run has to refuse both anyway. @@ -689,7 +882,7 @@ rm -rf "$MIN" # every one, and every one has to appear on this list. sudoers() { grep -oE '\$\{SUDO:\+\$SUDO \}[^ ]+' $D | sed "s/.*}//; s/'//g" | sort -u; } is "every root invocation is one of the ones we meant" "" \ - "$(sudoers | grep -vxF -e apt-get -e rm -e mkdir -e tar -e ln -e sh \ + "$(sudoers | grep -vxF -e apt-get -e rm -e mkdir -e tar -e ln -e sh -e install \ -e DEBIAN_FRONTEND=noninteractive -e '$SNAP' \ -e '$WORKDIR/mnt/Docker.app/Contents/MacOS/install' || true)" # `sh` is on that list for exactly one caller, and it must stay exactly one. @@ -702,6 +895,12 @@ is "…which was downloaded to that file first" "1" \ # POSIX sh has no pipefail: a download fed straight to a root shell reports the # SHELL's status, so a truncated body gets executed AND called a success. # Nothing in this script may have that shape. +# `install` is on the list for the Claude Desktop repository and nothing else: +# the signing key and the source line, each from this run's own directory. +is "…root \`install\` writes only the two Claude Desktop apt files" "2" \ + "$(grep -cE '\$\{SUDO:\+\$SUDO \}install -m 644 .\$WORKDIR/claude-desktop\.(asc. /usr/share/keyrings/claude-desktop-archive-keyring\.asc|list. /etc/apt/sources\.list\.d/claude-desktop\.list)' $D || true)" +is "…and no other root install exists" "2" \ + "$(grep -cE '\$\{SUDO:\+\$SUDO \}install ' $D || true)" is "nothing is ever piped into a root shell" "" \ "$(grep -nE 'curl[^|]*\|[^|]*\$\{SUDO' $D || true)" # The macOS root invocation, named. It runs out of this run's own 700 directory @@ -893,9 +1092,10 @@ printf '\n\033[1ma tool installed a moment ago is still found\033[0m\n' newbox if holed uv; then ln -s "$BOXPATH/_fake" "$SB/.local/bin/uv" - pick agents/specify-cli + BOXENV="DOTUP_MANIFEST=$UVM" + pick agents/uv-fixture out=$(box install 2>&1 | plain || true) - has "uv is found in ~/.local/bin, off PATH" "uv tool install specify-cli" "$(cat "$LOG")" + has "uv is found in ~/.local/bin, off PATH" "uv tool install uv-fixture" "$(cat "$LOG")" hasnt "…so nothing claims uv is missing" "uv missing" "$out" is "…and the run exits clean" "0" "$(boxrc install)" else diff --git a/README.md b/README.md index 8f77934..41bdc6b 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ and every group opens into the packages underneath it. Group boxes are a tri-state summary of their children, never an independent switch. ``` - ▸ [x] core 31/31 safe + ▸ [x] core 43/43 safe ▾ [~] media 2/3 safe [x] ffmpeg apt ffmpeg [ ] sox apt sox @@ -137,7 +137,7 @@ again over the same rows and it hands back exactly what it took. `^o` is a toggle, not "open all": press it again and everything closes. And on the default collapsed screen every group row counts as "shown", so a single -`^t` there reaches all 69 packages — including the invasive and private ones. +`^t` there reaches all 86 packages — including the invasive and private ones. That is the documented rule working as specified, but it is worth knowing before you press it. @@ -155,14 +155,17 @@ core fd safe fd-find fd binary is fdfind on ubuntu ``` A leading `-` in the apt or brew column means "not from this package manager": -`-tarball -npm -script -snap -deb -flatpak -uv -builtin -xcode`. A bare `-` +`-tarball -npm -script -snap -deb -flatpak -uv -go -builtin -xcode`. A bare `-` means unavailable there — and **Linux resolves apt-then-brew, not apt-instead-of-brew**, because `omp`, `herdr` and `lazygit` have no apt package -at all — and `core/brew` is itself a `script` row that those three `@needs`, so -ticking `lazygit` brings Homebrew with it. On Linux that means linuxbrew, under +at all — nor do `tea`, `bun` and `beads` — and `core/brew` is itself a `script` +row that all of them `@needs`, so ticking `lazygit` brings Homebrew with it. On Linux that means linuxbrew, under `/home/linuxbrew/.linuxbrew`; `/usr/local` is not touched. Channel order is a dependency graph and not a preference: `script` runs **before** `brew`, because otherwise brew would still be missing when the rows needing it are attempted. +`go` runs after `tarball` and `brew`, the two places a go comes from, because +`core/go-tools` is `go install` of gopls, goimports, golangci-lint and +staticcheck into `~/go/bin`. The installer probes `apt-cache policy` before it batches, and asks for the installation *candidate* rather than merely whether the name is known: on stock @@ -197,6 +200,19 @@ image can occupy first. The presence check asks `docker buildx version` and `docker compose version`, not merely whether a `docker` exists: `docker.io` and `podman-docker` satisfy the latter while shipping neither plugin. +The other vendor scripts follow the same shape, without root: `agents/claude` +is Anthropic's native installer (`claude.ai/install.sh`, to `~/.local/bin`, +self-updating), and `core/rust` is rustup with `--no-modify-path`, because +`~/.zshenv` already sources `~/.cargo/env`. `apps/claude-desktop` on Linux adds +Anthropic's own apt repository — the docker trap again — and refuses the +signing key unless its fingerprint is the one Anthropic publishes; with no +`gpg` to check it, it installs nothing. On a Mac it is the `claude` cask. + +The Nerd Font rows used to name `fonts-powerline`, which is the Powerline +glyphs only — not a Nerd Font — so the prompt and nvim's icons drew as tofu on +a fresh Linux box. On Linux they unpack the Nerd Fonts release into +`~/.local/share/fonts/NerdFonts/` and run `fc-cache`; on a Mac they are casks. + `@spec` carries the argument a channel needs but the package name cannot supply — the scoped npm name, the flatpak app id, the `.deb` source. It defaults to the package name. diff --git a/dot_local/bin/executable_dotup b/dot_local/bin/executable_dotup index 2d4d102..4ae4574 100755 --- a/dot_local/bin/executable_dotup +++ b/dot_local/bin/executable_dotup @@ -353,7 +353,7 @@ cmd_explain() { # Output: # apt|brew argument is the package name # npm|uv|snap|deb|flatpak argument is the @spec, defaulting to the pkg name -# tarball|script|xcode|builtin bespoke by nature; dispatched on the key +# tarball|script|go|xcode|builtin bespoke by nature; dispatched on the key # unavailable neither column offers it here resolve() { awk -F'\t' -v key="$1" -v plat="$PLAT" ' @@ -489,6 +489,9 @@ norm() { printf '%s\n' "$*" | tr ' ' '\n' | grep . | tr '\n' ' ' | sed 's/ $//'; redact_url() { printf '%s\n' "$1" | sed 's#://[^/@]*@#://@#'; } BWS_PIN=2.1.0 +# The fingerprint Anthropic's Linux install docs publish for the Claude Desktop +# apt repository's signing key. apps/claude-desktop refuses any other key. +CLAUDE_DESKTOP_FPR=31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE # The Bitwarden Secrets Manager CLI, installed by the PRIVATE tier only. # @@ -890,6 +893,54 @@ install_bespoke() { || { note_fail "$key" "tarball download failed or arrived empty"; continue; } run_sh "${SUDO:+$SUDO }rm -rf /usr/local/go && ${SUDO:+$SUDO }tar -xzf '$WORKDIR/go.tgz' -C /usr/local" \ || { note_fail "$key" "tarball extract failed"; continue; } ;; + fonts/hack-nerd-font|fonts/iosevka-nerd-font) + # Linux only: a Mac takes the brew casks. Ubuntu's fonts-powerline, + # which these rows used to name, is the Powerline glyphs alone -- + # not a Nerd Font -- so the prompt and nvim's icons drew as tofu on + # every fresh box. The Nerd Fonts release itself, per user, into + # the XDG font directory; nothing here needs root. + case $key in fonts/hack-nerd-font) fn=Hack ;; *) fn=Iosevka ;; esac + fdir=${XDG_DATA_HOME:-$HOME/.local/share}/fonts/NerdFonts/$fn + if [ "$DRYRUN" -eq 0 ] && [ -n "$(find "$fdir" -name '*.ttf' 2>/dev/null | head -1)" ]; then + say " $fn Nerd Font already in $fdir — leaving it"; continue + fi + if [ "$DRYRUN" -eq 0 ] && ! have xz; then + note_fail "$key" "xz is needed to unpack the release — core/xz did not install"; continue + fi + workdir || { note_fail "$key" "no private working directory"; continue; } + run_sh "curl -fsSL 'https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$fn.tar.xz' -o '$WORKDIR/$fn.tar.xz' && [ -s '$WORKDIR/$fn.tar.xz' ]" \ + || { note_fail "$key" "font download failed or arrived empty"; continue; } + run_sh "mkdir -p '$fdir' && tar -xJf '$WORKDIR/$fn.tar.xz' -C '$fdir'" \ + || { note_fail "$key" "font extract failed"; continue; } + if have fc-cache; then + run_sh "fc-cache -f '$fdir'" || warn "fc-cache failed; the font appears after the next login" + else + warn " fc-cache not found; the font appears after the next login" + fi ;; + core/go-tools) + # Its own channel, run after the tarball one, because `go install` + # needs the go that core/go may have unpacked a moment ago -- and + # the script channel runs before any tarball. Into GOBIN, else + # GOPATH/bin, which the zshrc puts on PATH. A tool already there is + # left alone: golangci-lint alone takes minutes to build. + GO=$(find_tool go || echo go) + if ! have go && [ "$DRYRUN" -eq 0 ]; then + note_fail "$key" "go missing — core/go did not install"; continue + fi + gobin= + if [ "$DRYRUN" -eq 0 ]; then + gobin=$("$GO" env GOBIN 2>/dev/null) || gobin= + [ -n "$gobin" ] || gobin=$("$GO" env GOPATH 2>/dev/null | cut -d: -f1)/bin + fi + for gm in golang.org/x/tools/gopls golang.org/x/tools/cmd/goimports \ + github.com/golangci/golangci-lint/v2/cmd/golangci-lint \ + honnef.co/go/tools/cmd/staticcheck; do + gt=${gm##*/} + if [ -n "$gobin" ] && [ -x "$gobin/$gt" ]; then + say " $gt already present — leaving it"; continue + fi + run_sh "$GO install $gm@latest" || note_fail "$key" "go install $gt failed" + done ;; core/chezmoi) # Circular by nature: dotup arrives *via* chezmoi. Present already # in every case that matters; here for the one where it is not. @@ -1047,6 +1098,79 @@ install_bespoke() { core/uv) if have uv && [ "$DRYRUN" -eq 0 ]; then say " uv already present — leaving it"; continue; fi run_sh "curl -LsSf https://astral.sh/uv/install.sh | sh" || note_fail "$key" "installer failed" ;; + agents/claude) + # Anthropic's native installer: a per-user install to ~/.local/bin + # that updates itself, which is what dev runs. Not npm -- that copy + # does not self-update and lags the native one. Downloaded to a file + # and checked non-empty before anything runs it, the docker shape: + # a pipe into bash would execute whatever fragment arrived and still + # report success. No sudo: it installs for the user running dotup. + if have claude && [ "$DRYRUN" -eq 0 ]; then + say " claude already present — leaving it (it updates itself)"; continue + fi + workdir || { note_fail "$key" "no private working directory"; continue; } + run_sh "curl -fsSL https://claude.ai/install.sh -o '$WORKDIR/claude-install.sh' && [ -s '$WORKDIR/claude-install.sh' ]" \ + || { note_fail "$key" "the Claude Code install script download failed or arrived empty"; continue; } + run_sh "bash '$WORKDIR/claude-install.sh'" \ + || { note_fail "$key" "the Claude Code installer failed"; continue; } + [ "$DRYRUN" -eq 1 ] || have claude \ + || note_fail "$key" "claude still not found after the installer ran" ;; + core/rust) + # rustup, per user, into ~/.cargo. --no-modify-path because the + # shell files are chezmoi's: ~/.zshenv already sources ~/.cargo/env, + # and rustup appending to them would be drift on the next apply. + cargo_home=${CARGO_HOME:-$HOME/.cargo} + if [ "$DRYRUN" -eq 0 ] && { have rustup || [ -x "$cargo_home/bin/rustup" ]; }; then + say " rustup already present — leaving it"; continue + fi + workdir || { note_fail "$key" "no private working directory"; continue; } + run_sh "curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs -o '$WORKDIR/rustup-init.sh' && [ -s '$WORKDIR/rustup-init.sh' ]" \ + || { note_fail "$key" "the rustup script download failed or arrived empty"; continue; } + run_sh "sh '$WORKDIR/rustup-init.sh' -y --no-modify-path" \ + || { note_fail "$key" "rustup-init failed"; continue; } + [ "$DRYRUN" -eq 1 ] || have rustup || [ -x "$cargo_home/bin/rustup" ] \ + || note_fail "$key" "rustup still not found after the installer ran" ;; + apps/claude-desktop) + # Linux only: a Mac takes the brew column's cask. Anthropic ships + # Claude Desktop from its OWN apt repository, the docker trap again + # -- as a plain apt name it has no candidate on a stock box. So the + # repository is configured here, the way Anthropic's Linux docs + # do it: the signing key into /usr/share/keyrings, one source line. + # + # A key that apt will trust for root-installed packages is not + # installed on faith. Its fingerprint has to match the one the docs + # publish, and with no gpg to read it there is no install at all -- + # refusing is cheap, and every desktop Ubuntu ships gnupg. + if have claude-desktop && [ "$DRYRUN" -eq 0 ]; then + say " claude-desktop already present — leaving it"; continue + fi + cd_arch=$(dpkg --print-architecture 2>/dev/null || uname -m) + case $cd_arch in amd64|arm64) ;; + *) note_fail "$key" "no Claude Desktop build for $cd_arch"; continue ;; esac + if [ "$DRYRUN" -eq 0 ] && ! have gpg; then + note_fail "$key" "gpg is needed to verify Anthropic's signing key — install gnupg and re-run"; continue + fi + workdir || { note_fail "$key" "no private working directory"; continue; } + run_sh "curl -fsSL https://downloads.claude.ai/claude-desktop/key.asc -o '$WORKDIR/claude-desktop.asc' && [ -s '$WORKDIR/claude-desktop.asc' ]" \ + || { note_fail "$key" "the Claude Desktop signing key download failed or arrived empty"; continue; } + if [ "$DRYRUN" -eq 0 ]; then + cd_fpr=$(gpg --show-keys --with-colons "$WORKDIR/claude-desktop.asc" 2>/dev/null \ + | awk -F: '$1=="fpr" {print $10; exit}') + [ "$cd_fpr" = "$CLAUDE_DESKTOP_FPR" ] || { + note_fail "$key" "signing key fingerprint is not Anthropic's — refusing to trust it"; continue; } + else + printf ' + verify the key fingerprint is %s\n' "$CLAUDE_DESKTOP_FPR" + fi + run_sh "printf '%s\\n' 'deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/claude-desktop-archive-keyring.asc] https://downloads.claude.ai/claude-desktop/apt/stable stable main' > '$WORKDIR/claude-desktop.list'" \ + || { note_fail "$key" "could not write the apt source line"; continue; } + run_sh "${SUDO:+$SUDO }install -m 644 '$WORKDIR/claude-desktop.asc' /usr/share/keyrings/claude-desktop-archive-keyring.asc" \ + || { note_fail "$key" "could not install the signing key"; continue; } + run_sh "${SUDO:+$SUDO }install -m 644 '$WORKDIR/claude-desktop.list' /etc/apt/sources.list.d/claude-desktop.list" \ + || { note_fail "$key" "could not add the apt repository"; continue; } + # The list apt_update_once fetched predates the repository. + APT_UPDATED=0; apt_update_once + run_sh "${SUDO:+$SUDO }DEBIAN_FRONTEND=noninteractive apt-get install -y claude-desktop" \ + || note_fail "$key" "apt install claude-desktop failed" ;; core/build-tools) # macOS only — the Linux side is build-essential through apt. if [ "$DRYRUN" -eq 0 ] && xcode-select -p >/dev/null 2>&1; then @@ -1102,9 +1226,10 @@ cmd_install() { # npm needs node (apt/brew), and uv tools need uv (script). # Order is a dependency graph, not a preference. apt first because most # things come from it; `script` BEFORE `brew`, because core/brew is a script - # row and the three brew-only packages cannot install until it has run; + # row and the brew-only packages cannot install until it has run; # npm after apt and tarball because node has to exist first; uv after script - # for the same reason. + # for the same reason; go after tarball and brew, the two places a go comes + # from, because core/go-tools is `go install`. BREW_EXTRA= install_apt "$(col apt)" install_bespoke script "$(keys script)" @@ -1112,6 +1237,7 @@ cmd_install() { install_bespoke tarball "$(keys tarball)" install_bespoke builtin "$(keys builtin)" install_bespoke xcode "$(keys xcode)" + install_bespoke go "$(keys go)" install_snap "$(col snap)" install_deb "$(col deb)" install_flatpak "$(col flatpak)" diff --git a/dot_local/share/dotup/packages.tsv b/dot_local/share/dotup/packages.tsv index dc6bf5b..217a403 100644 --- a/dot_local/share/dotup/packages.tsv +++ b/dot_local/share/dotup/packages.tsv @@ -15,7 +15,7 @@ # otherwise the worst child's note is right. # # A leading `-` in the apt or brew column means "not from this package manager": -# -tarball -npm -script -snap -deb -flatpak -uv -builtin -xcode. +# -tarball -npm -script -snap -deb -flatpak -uv -go -builtin -xcode. # A bare `-` means unavailable there. Linux falls back to the brew column before # giving up -- omp, herdr and lazygit have no apt package at all. The fallback is # one-directional: there is no apt on a Mac, so a `-` in the brew column is the @@ -28,7 +28,6 @@ @needs agents/pi core/node @needs agents/pi-plugins core/node @needs agents/pi-plugins agents/pi -@needs agents/specify-cli core/uv @needs core/mermaid-cli core/node @needs core/tree-sitter core/node # The three rows with no apt package at all. They resolved to brew and @@ -38,6 +37,15 @@ @needs core/lazygit core/brew @needs agents/omp core/brew @needs agents/herdr core/brew +@needs agents/beads core/brew +@needs core/tea core/brew +@needs core/bun core/brew +# `go install` needs a go. The -go channel runs after the tarball one, so the +# order is right on Linux; on a Mac go comes from brew, which runs first too. +@needs core/go-tools core/go +# The Nerd Fonts release is .tar.xz, and the 24.04 base image has no xz. +@needs fonts/hack-nerd-font core/xz +@needs fonts/iosevka-nerd-font core/xz @needs core/neovim core/imagemagick core/mermaid-cli @needs private/bws-secrets core/unzip # @@ -45,12 +53,12 @@ # rpiv-btw` installs somebody else's package. @spec agents/codex @openai/codex @spec agents/pi @earendil-works/pi-coding-agent -@spec agents/pi-plugins @juicesharp/rpiv-ask-user-question @juicesharp/rpiv-btw @juicesharp/rpiv-todo @samfp/pi-memory @tmustier/pi-ralph-wiggum pi-markdown-preview pi-powerline-footer pi-simplify pi-subagents pi-web-access -@spec agents/specify-cli specify-cli +@spec agents/pi-plugins @juicesharp/rpiv-ask-user-question @juicesharp/rpiv-btw @juicesharp/rpiv-todo @samfp/pi-memory @tmustier/pi-ralph-wiggum pi-markdown-preview pi-powerline-footer pi-simplify pi-subagents pi-web-access pi-lens pi-mcp-adapter @spec core/mermaid-cli @mermaid-js/mermaid-cli @spec core/tree-sitter tree-sitter-cli @spec core/bitwarden-cli bw @spec apps/obsidian md.obsidian.Obsidian +@spec apps/signal org.signal.Signal @spec apps/chrome https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb @spec apps/ghostty gh:mkasberg/ghostty-ubuntu:_%a_%v.deb core neovim safe -tarball neovim apt ships 0.9.5 — tarball to /opt/nvim @@ -75,6 +83,7 @@ core tree-sitter safe -npm -npm tree-sitter CLI — nvim-treesitter (main) refus core btop safe btop btop core htop safe htop htop core ncdu safe ncdu ncdu +core xz safe xz-utils xz the Nerd Fonts release is .tar.xz, and 24.04 minimal has no xz core unzip safe unzip unzip the bws release ships as a .zip, and 24.04 minimal has no unzip core tree safe tree tree core cmake safe cmake cmake @@ -87,14 +96,23 @@ core nmap safe nmap nmap core binwalk safe binwalk binwalk core pipx safe pipx pipx core age safe age age general purpose only now +core jq safe jq jq every Claude hook and the beads session hook pipe through it +core shellcheck safe shellcheck shellcheck the installer itself is linted with it +core clang-format safe clang-format clang-format +core gitleaks safe gitleaks gitleaks the pre-commit secret scan this repo's rules require +core tea safe - tea Gitea CLI — no apt package, pulls linuxbrew on linux +core bun safe - oven-sh/bun/bun builds the statusline — tap only, pulls linuxbrew on linux +core go-tools safe -go -go gopls goimports golangci-lint staticcheck — go install to ~/go/bin +core rust safe -script -script rustup to ~/.cargo, PATH left alone — ~/.zshenv sources ~/.cargo/env agents codex safe -npm -npm @openai/codex — unpinned, always latest agents pi safe -npm -npm @earendil-works/pi-coding-agent -agents pi-plugins safe -npm -npm 10 plugins: rpiv-*, pi-memory, pi-subagents, ... +agents pi-plugins safe -npm -npm 12 plugins: rpiv-*, pi-memory, pi-subagents, pi-lens, pi-mcp-adapter, ... agents omp safe - can1357/tap/omp oh my pi — tap only, pulls linuxbrew on linux agents herdr safe - herdr terminal workspace manager for agents -agents specify-cli safe -uv -uv uv tool install -fonts hack-nerd-font safe fonts-powerline font-hack-nerd-font -fonts iosevka-nerd-font safe fonts-powerline font-iosevka-nerd-font +agents claude safe -script -script Claude Code, Anthropic's native installer to ~/.local/bin — updates itself +agents beads safe - beads bd — the brew formula pulls dolt, its backend +fonts hack-nerd-font safe -tarball font-hack-nerd-font Nerd Fonts release to ~/.local/share/fonts on linux +fonts iosevka-nerd-font safe -tarball font-iosevka-nerd-font Nerd Fonts release to ~/.local/share/fonts on linux media ffmpeg safe ffmpeg ffmpeg media sox safe sox sox media p7zip safe p7zip-full p7zip @@ -103,6 +121,8 @@ apps ghostty gui -deb ghostty apps chrome gui -deb google-chrome apps firefox gui firefox firefox apps vlc gui vlc vlc +apps claude-desktop gui -script claude adds Anthropic's apt repository and signing key on linux +apps signal gui -flatpak signal flathub org.signal.Signal, --user on linux @networking daemons, listening ports, and setuid mount helpers networking openssh-server invasive openssh-server -builtin opens port 22 on every network this box can reach networking tailscale invasive tailscale tailscale daemon; joins a private network and rewrites DNS @@ -135,6 +155,7 @@ gpu container-toolkit invasive nvidia-container-toolkit - requires docker virt qemu invasive qemu-kvm - virt libvirt invasive libvirt-daemon-system - daemon + group membership virt virt-manager invasive virt-manager - +virt incus invasive incus - daemon; incus-admin membership is root-equivalent · the test-VM tool # The rows above host guests; these two ARE the guest. Both ship in # Ubuntu main — plain apt names, no vendor repository involved. virt guest-agent invasive qemu-guest-agent - daemon the qemu HOST can command (shutdown, fsfreeze) — for when this box is the guest