(location string)
| 66 | } |
| 67 | |
| 68 | func NewKernelFeaturesWithProps(location string) (KernelFeatures, error) { |
| 69 | var kfeatures KernelFeatures |
| 70 | |
| 71 | if location == "" { |
| 72 | bootConfigWithVersion := fmt.Sprintf("/boot/config-%s", defaultSysInfo.Machine) |
| 73 | kernelConfigLocations := []string{ |
| 74 | "/proc/config.gz", |
| 75 | "/boot/config", |
| 76 | } |
| 77 | |
| 78 | kernelConfigLocations = append(kernelConfigLocations, bootConfigWithVersion) |
| 79 | |
| 80 | location = findKernelConfigs(kernelConfigLocations) |
| 81 | if location == "" { |
| 82 | kfeatures.Error = ErrNoConfigs.Error() |
| 83 | return kfeatures, ErrNoConfigs |
| 84 | } |
| 85 | } else { |
| 86 | if !fileExists(location) { |
| 87 | kfeatures.Error = os.ErrNotExist.Error() |
| 88 | return kfeatures, os.ErrNotExist |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | rawFeatures, err := readKernelFeatures(location) |
| 93 | if err != nil { |
| 94 | kfeatures.Error = err.Error() |
| 95 | return kfeatures, err |
| 96 | } |
| 97 | |
| 98 | kfeatures.Raw = rawFeatures |
| 99 | |
| 100 | return kfeatures, nil |
| 101 | } |
| 102 | |
| 103 | var DefaultKernelFeatures, _ = NewKernelFeatures() |
| 104 |
no test coverage detected