diff --git a/.tests/mutations/32-brew-prereqs-apt-on-a-mac.mut b/.tests/mutations/32-brew-prereqs-apt-on-a-mac.mut new file mode 100644 index 0000000..06db0ee --- /dev/null +++ b/.tests/mutations/32-brew-prereqs-apt-on-a-mac.mut @@ -0,0 +1,11 @@ +# what: core/brew runs its apt prerequisites on every platform again +# why: a Mac has no apt; the line warns, and the sudo it needs is never asked for +# kills: darwin: no apt prerequisites on a machine with no apt +# run: unit +<</dev/null +ln -sf "$DARWIN/uname" "$SB/seal/uname"; BOXPATH=$SB/seal +pick core/brew agents/herdr +dry=$(box --print install 2>&1 | plain || true) +is "darwin: the Homebrew installer runs before any brew install" "yes" \ + "$(a=$(printf '%s\n' "$dry" | grep -n 'Homebrew/install/HEAD/install.sh' | head -1 | cut -d: -f1) + b=$(printf '%s\n' "$dry" | grep -n 'brew install herdr' | head -1 | cut -d: -f1) + [ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")" +is "darwin: …after asking for sudo, which NONINTERACTIVE cannot" "yes" \ + "$(a=$(printf '%s\n' "$dry" | grep -n '+ sudo -v$' | head -1 | cut -d: -f1) + b=$(printf '%s\n' "$dry" | grep -n 'Homebrew/install/HEAD/install.sh' | head -1 | cut -d: -f1) + [ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")" +hasnt "darwin: no apt prerequisites on a machine with no apt" "apt-get" "$dry" + 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. diff --git a/dot_local/bin/executable_dotup b/dot_local/bin/executable_dotup index 4ae4574..c52d630 100755 --- a/dot_local/bin/executable_dotup +++ b/dot_local/bin/executable_dotup @@ -967,11 +967,23 @@ install_bespoke() { note_fail "$key" "Homebrew refuses to install as root — run dotup as your own user" continue fi - # The installer's own documented prerequisites. git is already here, - # since the public tier cannot apply without it; the rest are not. - apt_update_once - run_sh "${SUDO:+$SUDO }DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential procps curl file git" \ - || warn "could not install Homebrew's build prerequisites" + if [ "$PLAT" = apt ]; then + # The installer's own documented prerequisites. git is already + # here, since the public tier cannot apply without it; the rest + # are not. A Mac has no apt: its prerequisite is the CLT, which + # the git check before apply already insisted on. + apt_update_once + run_sh "${SUDO:+$SUDO }DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential procps curl file git" \ + || warn "could not install Homebrew's build prerequisites" + else + # On macOS, NONINTERACTIVE=1 makes Homebrew's installer demand + # sudo WITHOUT a prompt: with no cached timestamp it aborts, and + # every brew row after it fails "brew missing". Ask for the + # password here, where a person can still type it. With nobody + # at the keyboard `sudo -v` fails and this says why. + run_sh "sudo -v" \ + || { note_fail "$key" "Homebrew on macOS needs an administrator password (sudo -v failed)"; continue; } + fi run_sh "NONINTERACTIVE=1 /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"" \ || { note_fail "$key" "the Homebrew installer failed"; continue; } # install_brew resolves through find_tool, which probes the linuxbrew diff --git a/dot_local/share/dotup/packages.tsv b/dot_local/share/dotup/packages.tsv index 217a403..5cd7688 100644 --- a/dot_local/share/dotup/packages.tsv +++ b/dot_local/share/dotup/packages.tsv @@ -75,7 +75,7 @@ core gh safe gh gh core chezmoi safe -script chezmoi bootstrap cannot come from the manifest core go safe -tarball go /usr/local/go on linux core uv safe -script uv astral installer to ~/.local/bin -core brew safe -script -builtin linuxbrew — the only source for lazygit, omp and herdr +core brew safe -script -script linuxbrew — the only source for lazygit, omp and herdr core node safe -tarball node apt ships 18.19 and the npm rows below need 20+ — tarball to /opt/node core imagemagick safe imagemagick imagemagick required by the nvim markdown render path core mermaid-cli safe -npm -npm mmdc — nvim renders mermaid fences with it