feat: manifest rows for the tools dev actually uses
A new laptop built from the manifest had no Claude Code, no beads, no jq and no Go tooling, and its Nerd Font rows installed fonts-powerline, which is the Powerline glyphs alone and not a Nerd Font. New rows: - agents/claude: Anthropic's native installer, downloaded to the run's workdir, checked non-empty, then run with bash (no pipe, no root). - agents/beads, core/tea, core/bun: brew-only, @needs core/brew. - core/jq, shellcheck, clang-format, gitleaks, xz: plain apt/brew rows. - core/go-tools: gopls, goimports, golangci-lint and staticcheck through a new `go` channel that runs after the tarball and brew channels, because `go install` needs a go. Tools already in GOBIN are left alone. - core/rust: rustup-init downloaded and checked, --no-modify-path because ~/.zshenv already sources ~/.cargo/env. - virt/incus: invasive, never ticked for you. - apps/claude-desktop (gui): on Linux, adds Anthropic's apt repository and refuses the signing key unless its fingerprint matches the published one. Mac uses the claude cask. - apps/signal (gui): flathub org.signal.Signal, --user; signal cask on Mac. Changed: the Nerd Font rows unpack the Nerd Fonts release into ~/.local/share/fonts and run fc-cache on Linux (they @needs core/xz). The pi plugin spec adds pi-lens and pi-mcp-adapter. agents/specify-cli is dropped. The uv channel stays, and its tests now run against a fixture row.
This commit is contained in:
1 parent
d09ba0f941
commit
01f77bceaa
7 files changed
+438
-29
No files matched your search
+24
-1
@@ -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*)
|
||||
|
||||
@@ -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
|
||||
|
||||
+7
-3
@@ -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 <dir> [--with name ...] [--without name ...]}; shift
|
||||
# Everything the seal KNOWS about, fixed before --without takes anything out: a
|
||||
|
||||
+209
-9
@@ -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
|
||||
|
||||
Reference in new issue
Block a user