Added which guard to check that command whether the command is available before installation

This commit is contained in:
2026-05-23 18:31:05 -05:00
parent f6fdb3f6ae
commit 1bd711dbc8
+5
View File
@@ -199,6 +199,11 @@ func resolveSystemPkgs(names []string) ([]string, []string) {
// isSystemPkgInstalled queries the host package manager.
func isSystemPkgInstalled(pkg string) bool {
// If 'which $pkg' returns a value, the package's command is available, so skip it.
if r, ok := probe([]string{"which", pkg}, 0); ok && r.ExitCode == 0 {
return true
}
switch pkgMgr {
case "dnf":
r, ok := probe([]string{"rpm", "-q", pkg}, 0)