distro

package
v0.90.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 19 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPipelinesFallback

func BuildPipelinesFallback() []string

Fallbacks: When a new method is added to an interface to provide to provide information that isn't available for older implementations, the older methods should return a fallback/default value by calling the appropriate function from below. Example: Exports() simply returns "assembler" for older image type implementations that didn't produce v1 manifests that have named pipelines.

func ExportsFallback

func ExportsFallback() []string

func GetHostDistroName added in v0.33.0

func GetHostDistroName() (string, error)

GetHostDistroName returns the name of the host distribution, such as "fedora-32" or "rhel-8.2". It does so by reading the /etc/os-release file.

func PayloadPackageSets

func PayloadPackageSets() []string

func PayloadPipelinesFallback

func PayloadPipelinesFallback() []string

func ReadOSReleaseFromTree added in v0.54.0

func ReadOSReleaseFromTree(root string) (map[string]string, error)

ReadOSReleaseFromTree reads the os-release file from the given root directory.

According to os-release(5), the os-release file should be located in either /etc/os-release or /usr/lib/os-release, so both locations are tried, with the former taking precedence.

Types

type Arch

type Arch interface {
	// Returns the name of the architecture.
	Name() string

	// Returns a sorted list of the names of the image types this architecture
	// supports.
	ListImageTypes() []string

	// Returns an object representing a given image format for this architecture,
	// on this distro.
	GetImageType(imageType string) (ImageType, error)

	// Returns the parent distro
	Distro() Distro
}

An Arch represents a given distribution's support for a given architecture.

type BasePartitionTableMap

type BasePartitionTableMap map[string]disk.PartitionTable

type BootMode

type BootMode uint64
const (
	BOOT_NONE BootMode = iota
	BOOT_LEGACY
	BOOT_UEFI
	BOOT_HYBRID
	UnsupportedCustomizationError = "unsupported blueprint customizations found for image type %q: (allowed: %s)"
	NoCustomizationsAllowedError  = "image type %q does not support customizations"
)

func (BootMode) String

func (m BootMode) String() string

type Distro

type Distro interface {
	// Returns the name of the distro.
	Name() string

	// Returns the codename of the distro.
	Codename() string

	// Returns the release version of the distro. This is used in repo
	// files on the host system and required for the subscription support.
	Releasever() string

	// Returns the OS version of the distro, which may contain minor versions
	// if the distro supports them. This is used in various places where the
	// minor version of the distro is needed to determine the correct
	// configuration.
	OsVersion() string

	// Returns the module platform id of the distro. This is used by DNF
	// for modularity support.
	ModulePlatformID() string

	// Returns the product name of the distro.
	Product() string

	// Returns the ostree reference template
	OSTreeRef() string

	// Returns a sorted list of the names of the architectures this distro
	// supports.
	ListArches() []string

	// Returns an object representing the given architecture as support
	// by this distro.
	GetArch(arch string) (Arch, error)
}

A Distro represents composer's notion of what a given distribution is.

type ID added in v0.33.0

type ID struct {
	Name         string
	MajorVersion int
	// MinorVersion is -1 if not specified
	MinorVersion int
}

ID represents a distro name and version

func ParseID added in v0.33.0

func ParseID(idStr string) (*ID, error)

ParseID parses a distro name and version from a Distro ID string. This is the generic parser, which is used by all distros as the base parser.

Limitations: - the distro name must not contain a dash

func (ID) String added in v0.33.0

func (id ID) String() string

type ImageConfig

type ImageConfig struct {
	Timezone            *string
	TimeSynchronization *osbuild.ChronyStageOptions
	Locale              *string
	Keyboard            *osbuild.KeymapStageOptions
	EnabledServices     []string
	DisabledServices    []string
	MaskedServices      []string
	DefaultTarget       *string
	Sysconfig           []*osbuild.SysconfigStageOptions

	// List of files from which to import GPG keys into the RPM database
	GPGKeyFiles []string

	// Disable SELinux labelling
	NoSElinux *bool

	// Do not use. Forces auto-relabelling on first boot.
	// See https://github.com/osbuild/osbuild/commit/52cb27631b587c1df177cd17625c5b473e1e85d2
	SELinuxForceRelabel *bool

	// Disable documentation
	ExcludeDocs *bool

	ShellInit []shell.InitFile

	// for RHSM configuration, we need to potentially distinguish the case
	// when the user want the image to be subscribed on first boot and when not
	RHSMConfig          map[subscription.RHSMStatus]*subscription.RHSMConfig
	SystemdLogind       []*osbuild.SystemdLogindStageOptions
	CloudInit           []*osbuild.CloudInitStageOptions
	Modprobe            []*osbuild.ModprobeStageOptions
	DracutConf          []*osbuild.DracutConfStageOptions
	SystemdUnit         []*osbuild.SystemdUnitStageOptions
	Authselect          *osbuild.AuthselectStageOptions
	SELinuxConfig       *osbuild.SELinuxConfigStageOptions
	Tuned               *osbuild.TunedStageOptions
	Tmpfilesd           []*osbuild.TmpfilesdStageOptions
	PamLimitsConf       []*osbuild.PamLimitsConfStageOptions
	Sysctld             []*osbuild.SysctldStageOptions
	DNFConfig           []*osbuild.DNFConfigStageOptions
	SshdConfig          *osbuild.SshdConfigStageOptions
	Authconfig          *osbuild.AuthconfigStageOptions
	PwQuality           *osbuild.PwqualityConfStageOptions
	WAAgentConfig       *osbuild.WAAgentConfStageOptions
	Grub2Config         *osbuild.GRUB2Config
	DNFAutomaticConfig  *osbuild.DNFAutomaticConfigStageOptions
	YumConfig           *osbuild.YumConfigStageOptions
	YUMRepos            []*osbuild.YumReposStageOptions
	Firewall            *osbuild.FirewallStageOptions
	UdevRules           *osbuild.UdevRulesStageOptions
	GCPGuestAgentConfig *osbuild.GcpGuestAgentConfigOptions
	WSLConfig           *osbuild.WSLConfStageOptions

	Files       []*fsnode.File
	Directories []*fsnode.Directory

	// KernelOptionsBootloader controls whether kernel command line options
	// should be specified in the bootloader grubenv configuration. Otherwise
	// they are specified in /etc/kernel/cmdline (default).
	//
	// This should only be used for old distros that use grub and it is
	// applied on all architectures, except for s390x.
	KernelOptionsBootloader *bool

	// The default OSCAP datastream to use for the image as a fallback,
	// if no datastream value is provided by the user.
	DefaultOSCAPDatastream *string

	// NoBLS configures the image bootloader with traditional menu entries
	// instead of BLS. Required for legacy systems like RHEL 7.
	NoBLS *bool

	// Read only sysroot and boot
	OSTreeConfSysrootReadOnly *bool

	// Lock the root account in the deployment unless the user defined root
	// user options in the build configuration.
	LockRootUser *bool

	IgnitionPlatform *string
}

ImageConfig represents a (default) configuration applied to the image payload.

func (*ImageConfig) InheritFrom

func (c *ImageConfig) InheritFrom(parentConfig *ImageConfig) *ImageConfig

InheritFrom inherits unset values from the provided parent configuration and returns a new structure instance, which is a result of the inheritance.

type ImageOptions

type ImageOptions struct {
	Size             uint64                     `json:"size"`
	OSTree           *ostree.ImageOptions       `json:"ostree,omitempty"`
	Subscription     *subscription.ImageOptions `json:"subscription,omitempty"`
	Facts            *facts.ImageOptions        `json:"facts,omitempty"`
	PartitioningMode disk.PartitioningMode      `json:"partitioning-mode,omitempty"`
}

The ImageOptions specify options for a specific image build

type ImageType

type ImageType interface {
	// Returns the name of the image type.
	Name() string

	// Returns the parent architecture
	Arch() Arch

	// Returns the canonical filename for the image type.
	Filename() string

	// Retrns the MIME-type for the image type.
	MIMEType() string

	// Returns the default OSTree ref for the image type.
	OSTreeRef() string

	// Returns the ISO Label for the image type. Returns an error if the image
	// type is not an ISO.
	ISOLabel() (string, error)

	// Returns the proper image size for a given output format. If the input size
	// is 0 the default value for the format will be returned.
	Size(size uint64) uint64

	// Returns the corresponding partion type ("gpt", "dos") or "" the image type
	// has no partition table. Only support for RHEL 8.5+
	PartitionType() string

	// Returns the corresponding boot mode ("legacy", "uefi", "hybrid") or "none"
	BootMode() BootMode

	// Returns the names of the pipelines that set up the build environment (buildroot).
	BuildPipelines() []string

	// Returns the names of the pipelines that create the image.
	PayloadPipelines() []string

	// Returns the package set names safe to install custom packages via custom repositories.
	PayloadPackageSets() []string

	// Returns the names of the stages that will produce the build output.
	Exports() []string

	// Returns an osbuild manifest, containing the sources and pipeline necessary
	// to build an image, given output format with all packages and customizations
	// specified in the given blueprint; it also returns any warnings (e.g.
	// deprecation notices) generated by the manifest.
	// The packageSpecSets must be labelled in the same way as the originating PackageSets.
	Manifest(bp *blueprint.Blueprint, options ImageOptions, repos []rpmmd.RepoConfig, seed int64) (*manifest.Manifest, []string, error)
}

An ImageType represents a given distribution's support for a given Image Type for a given architecture.

type InstallerConfig added in v0.54.0

type InstallerConfig struct {
	// Additional dracut modules and drivers to enable
	AdditionalDracutModules []string
	AdditionalDrivers       []string
}

InstallerConfig represents a configuration for the installer part of an Installer image type.

type ParseError added in v0.33.0

type ParseError struct {
	ToParse string
	Msg     string
	Inner   error
}

func (ParseError) Error added in v0.33.0

func (e ParseError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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