feat(platform): add Reinstall helpers to Pacman and Yay

This commit is contained in:
MDietermann
2026-04-14 21:44:47 +02:00
parent 1cd3886d56
commit e6e12ab5fd
4 changed files with 69 additions and 0 deletions

View File

@@ -76,6 +76,17 @@ func (p Pacman) Install(ctx context.Context, pkgs []string) error {
return p.Runner.Run(ctx, "sudo", args...)
}
// Reinstall runs `sudo pacman -S --noconfirm <pkgs...>` WITHOUT `--needed`,
// so pacman physically re-fetches and reinstalls the packages even if they
// are already present. Used by the `--force` flag to bypass idempotency.
func (p Pacman) Reinstall(ctx context.Context, pkgs []string) error {
if len(pkgs) == 0 {
return nil
}
args := append([]string{"pacman", "-S", "--noconfirm"}, pkgs...)
return p.Runner.Run(ctx, "sudo", args...)
}
// Update runs `sudo pacman -Syu --noconfirm` (full sync + system upgrade).
// On Arch, a bare `pacman -Sy` followed by an install is the partial-upgrade
// anti-pattern that can break the system when a dep's ABI changes, so we