Documentation
¶
Index ¶
- Constants
- func ExportsFallback() []string
- func GetHostDistroName() (string, error)
- func PayloadPackageSets() []string
- func ReadOSReleaseFromTree(root string) (map[string]string, error)
- func SeedFrom(p *int64) int64
- func ValidateConfig(t ImageTypeValidator, bp blueprint.Blueprint) error
- type Arch
- type BasePartitionTableMap
- type BootcImageOptions
- type CustomDepsolverDistro
- type DNFConfig
- type Distro
- type ID
- type ISOConfig
- type ImageConfig
- type ImageOptions
- type ImageType
- type ImageTypeValidator
- type InstallerConfig
- type ParseError
- type Sysconfig
Constants ¶
const ( UnsupportedCustomizationError = "unsupported blueprint customizations found for image type %q: (allowed: %s)" NoCustomizationsAllowedError = "image type %q does not support customizations" )
Variables ¶
This section is empty.
Functions ¶
func ExportsFallback ¶
func ExportsFallback() []string
func GetHostDistroName ¶ added in v0.33.0
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 ReadOSReleaseFromTree ¶ added in v0.40.2
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.
func ValidateConfig ¶ added in v0.180.0
func ValidateConfig(t ImageTypeValidator, bp blueprint.Blueprint) error
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 BootcImageOptions ¶ added in v0.210.0
type BootcImageOptions struct {
InstallerPayloadRef string `json:"installer_payload_ref,omitempty"`
}
type CustomDepsolverDistro ¶ added in v0.221.0
type DNFConfig ¶ added in v0.40.2
type DNFConfig struct {
Options *osbuild.DNFConfigStageOptions
SetReleaseverVar *bool `yaml:"set_releasever_var"`
}
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
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) VersionString ¶ added in v0.40.2
type ISOConfig ¶ added in v0.232.0
type ISOConfig struct {
// BootType defines what type of bootloader is used for the iso
BootType *manifest.ISOBootType `yaml:"boot_type,omitempty"`
// RootfsType defines what rootfs (squashfs, erofs,ext4)
// is used
RootfsType *manifest.ISORootfsType `yaml:"rootfs_type,omitempty"`
// Metadata field on the ISO for the volume id
Label *string `yaml:"label,omitempty"`
// Metadata field on the ISO for the creation tool
Preparer *string `yaml:"preparer,omitempty"`
// Metadata field on the ISO for the publisher
Publisher *string `yaml:"publisher,omitempty"`
// Metadata field on the ISO for the application ID
Application *string `yaml:"application,omitempty"`
}
ISOConfig represents configuration for the ISO part of images that are packed into ISOs.
func (*ISOConfig) InheritFrom ¶ added in v0.232.0
InheritFrom inherits unset values from the provided parent configuration and returns a new structure instance, which is a result of the inheritance.
type ImageConfig ¶
type ImageConfig struct {
Hostname *string `yaml:"hostname,omitempty"`
Timezone *string `yaml:"timezone,omitempty"`
TimeSynchronization *osbuild.ChronyStageOptions `yaml:"time_synchronization,omitempty"`
Locale *string `yaml:"locale,omitempty"`
Keyboard *osbuild.KeymapStageOptions
EnabledServices []string `yaml:"enabled_services,omitempty"`
DisabledServices []string `yaml:"disabled_services,omitempty"`
MaskedServices []string
DefaultTarget *string `yaml:"default_target,omitempty"`
Sysconfig *Sysconfig `yaml:"sysconfig,omitempty"`
DefaultKernel *string `yaml:"default_kernel,omitempty"`
UpdateDefaultKernel *bool `yaml:"update_default_kernel,omitempty"`
KernelOptions []string `yaml:"kernel_options,omitempty"`
// The name of the default kernel to use for the image type.
// NOTE: Currently this overrides the kernel named in the blueprint. The
// only image type that uses it is the azure-cvm, which doesn't allow
// kernel selection. The option should generally be a fallback for when the
// blueprint doesn't specify a kernel.
//
// This option has no effect on the DefaultKernel option under Sysconfig.
// If both options are set, they should have the same value.
// These two options should be unified.
DefaultKernelName *string `yaml:"default_kernel_name"`
// List of files from which to import GPG keys into the RPM database
GPGKeyFiles []string `yaml:"gpgkey_files,omitempty"`
// Disable SELinux labelling
NoSELinux *bool `yaml:"no_selinux,omitempty"`
// Do not use. Forces auto-relabelling on first boot.
// See https://github.com/osbuild/osbuild/commit/52cb27631b587c1df177cd17625c5b473e1e85d2
SELinuxForceRelabel *bool `yaml:"selinux_force_relabel,omitempty"`
// Disable documentation
ExcludeDocs *bool `yaml:"exclude_docs,omitempty"`
ShellInit []shell.InitFile `yaml:"shell_init,omitempty"`
// 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 `yaml:"rhsm_config,omitempty"`
SystemdLogind []*osbuild.SystemdLogindStageOptions `yaml:"systemd_logind,omitempty"`
CloudInit []*osbuild.CloudInitStageOptions `yaml:"cloud_init"`
Modprobe []*osbuild.ModprobeStageOptions
DracutConf []*osbuild.DracutConfStageOptions `yaml:"dracut_conf"`
SystemdDropin []*osbuild.SystemdUnitStageOptions `yaml:"systemd_dropin,omitempty"`
SystemdUnit []*osbuild.SystemdUnitCreateStageOptions `yaml:"systemd_unit,omitempty"`
Authselect *osbuild.AuthselectStageOptions `yaml:"authselect"`
SELinuxConfig *osbuild.SELinuxConfigStageOptions `yaml:"selinux_config,omitempty"`
Tuned *osbuild.TunedStageOptions
Tmpfilesd []*osbuild.TmpfilesdStageOptions
PamLimitsConf []*osbuild.PamLimitsConfStageOptions `yaml:"pam_limits_conf,omitempty"`
Sysctld []*osbuild.SysctldStageOptions
// Do not use DNFConfig directly, call "DNFConfigOptions()"
DNFConfig *DNFConfig `yaml:"dnf_config"`
SshdConfig *osbuild.SshdConfigStageOptions `yaml:"sshd_config"`
Authconfig *osbuild.AuthconfigStageOptions
PwQuality *osbuild.PwqualityConfStageOptions
WAAgentConfig *osbuild.WAAgentConfStageOptions `yaml:"waagent_config,omitempty"`
Grub2Config *osbuild.GRUB2Config `yaml:"grub2_config,omitempty"`
DNFAutomaticConfig *osbuild.DNFAutomaticConfigStageOptions `yaml:"dnf_automatic_config"`
YumConfig *osbuild.YumConfigStageOptions `yaml:"yum_config,omitempty"`
YUMRepos []*osbuild.YumReposStageOptions `yaml:"yum_repos,omitempty"`
Firewall *osbuild.FirewallStageOptions
UdevRules *osbuild.UdevRulesStageOptions `yaml:"udev_rules,omitempty"`
GCPGuestAgentConfig *osbuild.GcpGuestAgentConfigOptions `yaml:"gcp_guest_agent_config,omitempty"`
NetworkManager *osbuild.NMConfStageOptions `yaml:"network_manager,omitempty"`
Presets []osbuild.Preset `yaml:"presets,omitempty"`
WSL *wsl.WSL `yaml:"wsl,omitempty"`
OCI *oci.OCI `yaml:"oci,omitempty"`
OSTreeServer *ostreeserver.OSTreeServer `yaml:"ostree_server,omitempty"`
Users []users.User
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 `yaml:"kernel_options_bootloader,omitempty"`
// The default OSCAP datastream to use for the image as a fallback,
// if no datastream value is provided by the user.
DefaultOSCAPDatastream *string `yaml:"default_oscap_datastream,omitempty"`
// NoBLS configures the image bootloader with traditional menu entries
// instead of BLS. Required for legacy systems like RHEL 7.
NoBLS *bool `yaml:"no_bls,omitempty"`
// Read only sysroot and boot
OSTreeConfSysrootReadOnly *bool `yaml:"ostree_conf_sysroot_readonly,omitempty"`
// Lock the root account in the deployment unless the user defined root
// user options in the build configuration.
LockRootUser *bool `yaml:"lock_root_user,omitempty"`
IgnitionPlatform *string `yaml:"ignition_platform,omitempty"`
// InstallWeakDeps enables installation of weak dependencies for packages
// that are statically defined for the pipeline.
InstallWeakDeps *bool `yaml:"install_weak_deps,omitempty"`
// InstallLangs determines which locales are installed by RPM, the default
// is `all`.
InstallLangs []string `yaml:"install_langs,omitempty"`
// How to handle the /etc/machine-id file, when set to true it causes the
// machine id to be set to 'uninitialized' which causes ConditionFirstboot
// to be triggered in systemd
MachineIdUninitialized *bool `yaml:"machine_id_uninitialized,omitempty"`
// MountUnits creates systemd .mount units to describe the filesystem
// instead of writing to /etc/fstab
MountUnits *bool `yaml:"mount_units,omitempty"`
// Indicates if rhc should be set to permissive when creating the registration script
PermissiveRHC *bool `yaml:"permissive_rhc,omitempty"`
// VersionlockPackges uses dnf versionlock to lock a package to the version
// that is installed during image build, preventing it from being updated.
// This is only supported for distributions that use dnf4, because osbuild
// only has a stage for dnf4 version locking.
VersionlockPackages []string `yaml:"versionlock_packages,omitempty"`
// BootupdGenMetadata enables bootupd metadata generation for ostree commits.
// When enabled, runs bootupctl backend generate-update-metadata to transform
// /usr/lib/ostree-boot into bootupd-compatible update metadata.
// Only set this to true if the bootupd package is available in the image.
BootupdGenMetadata *bool `yaml:"bootupd_gen_metadata,omitempty"`
}
ImageConfig represents a (default) configuration applied to the image payload.
func (*ImageConfig) DNFConfigOptions ¶ added in v0.40.2
func (c *ImageConfig) DNFConfigOptions(osVersion string) (*osbuild.DNFConfigStageOptions, error)
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.
func (*ImageConfig) SysconfigStageOptions ¶ added in v0.40.2
func (c *ImageConfig) SysconfigStageOptions() []*osbuild.SysconfigStageOptions
type ImageOptions ¶
type ImageOptions struct {
Size uint64 `json:"size"`
OSTree *ostree.ImageOptions `json:"ostree,omitempty"`
Bootc *BootcImageOptions `json:"bootc,omitempty"`
Subscription *subscription.ImageOptions `json:"subscription,omitempty"`
Facts *facts.ImageOptions `json:"facts,omitempty"`
PartitioningMode partition.PartitioningMode `json:"partitioning-mode,omitempty"`
UseBootstrapContainer bool `json:"use_bootstrap_container,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 aliases for the image type.
Aliases() []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() disk.PartitionTableType
// Return the base partition tabe for the given image type, will
// return `nil` if there is none
BasePartitionTable() (*disk.PartitionTable, error)
// Returns the corresponding boot mode ("legacy", "uefi", "hybrid") or "none"
BootMode() platform.BootMode
// 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
// A list of customization options that this image requires.
RequiredBlueprintOptions() []string
// A list of customization options that this image supports.
SupportedBlueprintOptions() []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.
// A custom seed for the rng can be specified, if nil the seed will
// be random.
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 ImageTypeValidator ¶ added in v0.180.0
type InstallerConfig ¶ added in v0.40.2
type InstallerConfig struct {
EnabledAnacondaModules []string `yaml:"enabled_anaconda_modules"`
// Additional dracut modules and drivers to enable
AdditionalDracutModules []string `yaml:"additional_dracut_modules"`
AdditionalDrivers []string `yaml:"additional_drivers"`
// XXX: this is really here only for compatibility/because of drift in the "imageInstallerImage"
// between fedora/rhel
KickstartUnattendedExtraKernelOpts []string `yaml:"kickstart_unattended_extra_kernel_opts"`
// DefaultMenu will set the grub2 iso menu's default setting
DefaultMenu *int `yaml:"default_menu"`
// InstallWeakDeps determines if weak dependencies are installed in the installer
// environment.
InstallWeakDeps *bool `yaml:"install_weak_deps,omitempty"`
// Lorax template settings for org.osbuild.lorax stage
LoraxTemplates []manifest.InstallerLoraxTemplate `yaml:"lorax_templates,omitempty"`
LoraxTemplatePackage *string `yaml:"lorax_template_package"`
LoraxLogosPackage *string `yaml:"lorax_logos_package"`
LoraxReleasePackage *string `yaml:"lorax_release_package"`
// ISOFiles contains files to copy from the `anaconda-tree` to the ISO root, this is
// used to copy (for example) license and legal information into the root of the ISO. An
// array of source (in anaconda-tree) and destination (in iso-tree).
ISOFiles [][2]string `yaml:"iso_files"`
}
InstallerConfig represents a configuration for the installer part of an Installer image type.
func (*InstallerConfig) InheritFrom ¶ added in v0.40.2
func (c *InstallerConfig) InheritFrom(parentConfig *InstallerConfig) *InstallerConfig
InheritFrom inherits unset values from the provided parent configuration and returns a new structure instance, which is a result of the inheritance.
type ParseError ¶ added in v0.33.0
func (ParseError) Error ¶ added in v0.33.0
func (e ParseError) Error() string
func (ParseError) Unwrap ¶ added in v0.191.0
func (e ParseError) Unwrap() error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
bootctest/exe
command
|
|
|
package defs contain the distro definitions used by the "images" library
|
package defs contain the distro definitions used by the "images" library |