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

@@ -52,6 +52,17 @@ func (y *Yay) Install(ctx context.Context, pkgs []string) error {
return y.Runner.Run(ctx, "yay", args...)
}
// Reinstall runs `yay -S --noconfirm <pkgs...>` WITHOUT `--needed`, forcing
// yay/pacman to re-fetch and reinstall the packages even if already present.
// Used by the `--force` flag to bypass idempotency.
func (y *Yay) Reinstall(ctx context.Context, pkgs []string) error {
if len(pkgs) == 0 {
return nil
}
args := append([]string{"-S", "--noconfirm"}, pkgs...)
return y.Runner.Run(ctx, "yay", args...)
}
func shellQuote(s string) string {
return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
}