Skip to content

fix: don't abort clean install when Homebrew prerequisites are missing#567

Open
DevSecNinja with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-clean-wsl-install-failed
Open

fix: don't abort clean install when Homebrew prerequisites are missing#567
DevSecNinja with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-clean-wsl-install-failed

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

On a clean Linux system (e.g. a fresh WSL distro) git/curl aren't present yet — they're installed later by the package-install script. The Homebrew setup script (run_once_before_05-install-homebrew.sh.tmpl) hard-failed with exit 1 on the missing dependency, aborting the entire chezmoi apply:

ERROR  [install-homebrew] Missing required dependencies: git
HINT   [install-homebrew]   sudo apt-get install -y git
chezmoi: .chezmoiscripts/linux/05-install-homebrew.sh: exit status 1

Since Homebrew is optional on Linux, a missing prerequisite should not tank the whole install.

Changes

  • Auto-install prerequisites on Linux — the missing-deps branch now attempts apt-get/dnf install (Ubuntu/Debian and Fedora/RHEL/CentOS) when passwordless sudo is available, instead of only printing a hint.
  • Graceful skip instead of abort — re-checks with command -v after the install attempt; if anything is still missing it logs which deps remain and exit 0, letting chezmoi apply continue (the package script installs git/curl shortly after).
  • macOS unchanged — the non-Linux template branch keeps exit 1, since Homebrew is required there and git/curl ship with the system.
  • Tests — added bats coverage in test-chezmoi-scripts.bats asserting the Linux auto-install commands exist and the script no longer hard-fails on missing deps.

Notes

  • The apt-get/dnf calls use || true intentionally (script runs under set -euo pipefail); the subsequent STILL_MISSING re-check is the source of truth for per-dependency outcome and logging.
  • One unrelated pre-existing test failure (package-utils: Windows package IDs can match by package suffix) is present on the base branch and untouched here.

Copilot AI linked an issue Jul 10, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix clean WSL install failure fix: don't abort clean install when Homebrew prerequisites are missing Jul 10, 2026
Copilot AI requested a review from DevSecNinja July 10, 2026 13:01
@DevSecNinja
DevSecNinja marked this pull request as ready for review July 10, 2026 13:05
@DevSecNinja

Copy link
Copy Markdown
Owner

@copilot can you fix the failing test?

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you fix the failing test?

Fixed in 8582e50. The package-utils: Windows package IDs can match by package suffix test asserted mise for the windows platform, but mise is a Linux/WSL tool and isn't in the Windows winget list — so it always failed. Updated the test to use chezmoi, which is a real Windows package (twpayne.chezmoi) and genuinely exercises the reverse-DNS suffix matching. Full suite is green now.

@copilot can you fix the failing test?

Correction: the commit hash is 1a0f7d0 (not 8582e50).

auto-merge was automatically disabled July 10, 2026 15:07

Head branch was pushed to by a user without write access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: clean wsl install failed

2 participants