MCPcopy Index your code
hub / github.com/celer-pkg/celer / checkRedHatLibraryInstalled

Function checkRedHatLibraryInstalled

buildtools/system_tools.go:147–162  ·  view source on GitHub ↗
(libraryName string)

Source from the content-addressed store, hash-verified

145}
146
147func checkRedHatLibraryInstalled(libraryName string) (bool, error) {
148 // Use rpm -q to check if the library is installed.
149 libraryName = strings.TrimPrefix(libraryName, "yum:")
150 executor := cmd.NewExecutor("", "rpm", "-q", libraryName)
151 out, err := executor.ExecuteOutput()
152 if err != nil {
153 return false, fmt.Errorf("failed to run rpm -q: %v", err)
154 }
155
156 // Check if the library is installed.
157 if !strings.Contains(string(out), "not installed") {
158 return true, nil
159 }
160
161 return false, nil
162}

Callers 1

CheckSystemToolsFunction · 0.85

Calls 2

NewExecutorFunction · 0.92
ExecuteOutputMethod · 0.80

Tested by

no test coverage detected