From 1bd711dbc806f890927a479e5dca69b164c18a59 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Sat, 23 May 2026 18:31:05 -0500 Subject: [PATCH] Added which guard to check that command whether the command is available before installation --- pkgmgr.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgmgr.go b/pkgmgr.go index 86e925d..5a3160c 100644 --- a/pkgmgr.go +++ b/pkgmgr.go @@ -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)