Refactor kernel support
- Remove kernel imports and kmods images - Repurpose KernelOverride as container path - Support Kernel.Version as version prefix for kernel selection - Compare initramfs by version Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
d87ed27d8d
commit
8f21d54243
26
internal/pkg/util/version.go
Normal file
26
internal/pkg/util/version.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-version"
|
||||
)
|
||||
|
||||
var (
|
||||
versionPattern *regexp.Regexp
|
||||
)
|
||||
|
||||
func init() {
|
||||
versionPattern = regexp.MustCompile(`\d+\.\d+\.\d+(-[\d\.]+|)`)
|
||||
}
|
||||
|
||||
func ParseVersion(versionString string) *version.Version {
|
||||
matches := versionPattern.FindAllString(versionString, -1)
|
||||
for i := len(matches) - 1; i >= 0; i-- {
|
||||
if version_, err := version.NewVersion(strings.TrimSuffix(matches[i], ".")); err == nil {
|
||||
return version_
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user