Documentation
¶
Overview ¶
Package kernelversion provides a simple mechanism for checking whether the running kernel is at least as new as some baseline kernel version. This is often useful when checking for features that would be too complicated to test support for (or in cases where we know that some kernel features in backport-heavy kernels are broken and need to be avoided).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GreaterEqualThan ¶
func GreaterEqualThan(wantKver KernelVersion) (bool, error)
GreaterEqualThan returns true if the the host kernel version is greater than or equal to the provided KernelVersion. When doing this comparison, any non-numerical suffixes of the host kernel version are ignored.
If the number of components provided is not equal to the number of numerical components of the host kernel version, any missing components are treated as 0. This means that GreaterEqualThan(KernelVersion{4}) will be treated the same as GreaterEqualThan(KernelVersion{4, 0, 0, ..., 0, 0}), and that if the host kernel version is "4" then GreaterEqualThan(KernelVersion{4, 1}) will return false (because the host version will be treated as "4.0").
Types ¶
type KernelVersion ¶
type KernelVersion []uint64
KernelVersion is a numeric representation of the key numerical elements of a kernel version (for instance, "4.1.2-default-1" would be represented as KernelVersion{4, 1, 2}).
func (KernelVersion) String ¶
func (kver KernelVersion) String() string