distro

package
v0.99.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

All contains all Linux distribution options

View Source
var IDMapping = map[string]Type{
	"debian":        Debian,
	"ubuntu":        Ubuntu,
	"rhel":          RedHat,
	"centos":        CentOS,
	"fedora":        Fedora,
	"alpine":        Alpine,
	"busybox":       Busybox,
	"amzn":          AmazonLinux,
	"ol":            OracleLinux,
	"arch":          ArchLinux,
	"opensuse-leap": OpenSuseLeap,
	"sles":          SLES,
	"photon":        Photon,
	"echo":          Echo,
	"mariner":       Mariner,
	"azurelinux":    Azure,
	"rocky":         RockyLinux,
	"almalinux":     AlmaLinux,
	"gentoo":        Gentoo,
	"wolfi":         Wolfi,
	"chainguard":    Chainguard,
	"minimos":       MinimOS,
	"raspbian":      Raspbian,
}

IDMapping maps a distro ID from the /etc/os-release (e.g. like "ubuntu") to a Distro type.

Functions

This section is empty.

Types

type Distro

type Distro struct {
	Type     Type
	Version  string   // major.minor.patch
	Codename string   // in lieu of a version e.g. "fossa" instead of "20.04"
	Channels []string // distinguish between different feeds for fix and vulnerability data, e.g. "eus" for RHEL
	IDLike   []string
	// contains filtered or unexported fields
}

Distro represents a Linux Distribution.

func FromRelease added in v0.92.0

func FromRelease(linuxRelease *linux.Release, channels []FixChannel) *Distro

FromRelease attempts to get a distro from the linux release, only logging any errors

func New

func New(t Type, version, label string, idLikes ...string) *Distro

New creates a new Distro object populated with the given values.

func NewFromNameVersion added in v0.92.0

func NewFromNameVersion(name, version string) *Distro

NewFromNameVersion creates a new Distro object derived from the provided name and version

func NewFromRelease

func NewFromRelease(release linux.Release, channels []FixChannel) (*Distro, error)

NewFromRelease creates a new Distro object derived from a syft linux.Release object.

func (Distro) Disabled added in v0.58.0

func (d Distro) Disabled() bool

Disabled is a way to convey if a Linux distribution is not supported by Grype.

func (Distro) ID added in v0.97.1

func (d Distro) ID() string

func (Distro) MajorVersion

func (d Distro) MajorVersion() string

MajorVersion returns the major version value from the pseudo-semantically versioned distro version value.

func (Distro) MinorVersion added in v0.88.0

func (d Distro) MinorVersion() string

MinorVersion returns the minor version value from the pseudo-semantically versioned distro version value.

func (Distro) Name

func (d Distro) Name() string

func (Distro) RemainingVersion added in v0.91.0

func (d Distro) RemainingVersion() string

func (Distro) String

func (d Distro) String() string

String returns a human-friendly representation of the Linux distribution.

func (Distro) VersionString added in v0.97.1

func (d Distro) VersionString() string

type FixChannel added in v0.97.1

type FixChannel struct {
	// Name is the name of the channel, e.g. "eus" for RHEL
	Name string

	// IDs is a list of distro release IDs that this channel applies to, e.g. "rhel" for RHEL (this is relative to the /etc/os-release ID field)
	IDs []string

	// Apply indicates how the channel should be applied to the distro
	Apply FixChannelEnabled

	// Versions is a version constraint that indicates which versions of the distro this channel applies to (e.g. ">= 8.0" for RHEL 8 and above)
	Versions version.Constraint
}

FixChannel represents a subscription or repository where package fixes and updates are provided for a Linux distribution

type FixChannelEnabled added in v0.97.1

type FixChannelEnabled string
const (
	// ChannelNeverEnabled means that the channel should never be applied to the distro
	ChannelNeverEnabled FixChannelEnabled = "never"

	// ChannelAlwaysEnabled means that the channel should always be applied to the distro
	ChannelAlwaysEnabled FixChannelEnabled = "always"

	// ChannelConditionallyEnabled means that the channel should conditionally be applied to the distro if there is SBOM material that indicates the channel was configured at build time
	ChannelConditionallyEnabled FixChannelEnabled = "auto"
)

type FixChannels added in v0.97.1

type FixChannels []FixChannel

func DefaultFixChannels added in v0.97.1

func DefaultFixChannels() FixChannels

func (FixChannels) Apply added in v0.97.1

func (f FixChannels) Apply(enable FixChannelEnabled) FixChannels

func (FixChannels) Get added in v0.97.1

func (f FixChannels) Get(name string) *FixChannel

type Type

type Type string

Type represents the different Linux distribution options

const (
	Debian       Type = "debian"
	Ubuntu       Type = "ubuntu"
	RedHat       Type = "redhat"
	CentOS       Type = "centos"
	Fedora       Type = "fedora"
	Alpine       Type = "alpine"
	Busybox      Type = "busybox"
	AmazonLinux  Type = "amazonlinux"
	OracleLinux  Type = "oraclelinux"
	ArchLinux    Type = "archlinux"
	OpenSuseLeap Type = "opensuseleap"
	SLES         Type = "sles"
	Photon       Type = "photon"
	Echo         Type = "echo"
	Windows      Type = "windows"
	Mariner      Type = "mariner"
	Azure        Type = "azurelinux"
	RockyLinux   Type = "rockylinux"
	AlmaLinux    Type = "almalinux"
	Gentoo       Type = "gentoo"
	Wolfi        Type = "wolfi"
	Chainguard   Type = "chainguard"
	MinimOS      Type = "minimos"
	Raspbian     Type = "raspbian"
)

func TypeFromRelease

func TypeFromRelease(release linux.Release) Type

func (Type) String

func (t Type) String() string

String returns the string representation of the given Linux distribution.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL