(libraryName string)
| 145 | } |
| 146 | |
| 147 | func 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 | } |
no test coverage detected