elemental

package
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elemental

type Elemental struct {
	// contains filtered or unexported fields
}

Elemental is the struct meant to self-contain most utils and actions related to Elemental, like installing or applying selinux

func NewElemental

func NewElemental(config *agentConfig.Config) *Elemental

func (*Elemental) CheckActiveDeployment

func (e *Elemental) CheckActiveDeployment(labels []string) bool

CheckActiveDeployment returns true if at least one of the provided filesystem labels is found within the system

func (*Elemental) CopyCloudConfig

func (e *Elemental) CopyCloudConfig(cloudInit []string) (err error)

CopyCloudConfig will check if there is a cloud init in the config and store it on the target

func (Elemental) CreateFileSystemImage

func (e Elemental) CreateFileSystemImage(img *v1.Image) error

CreateFileSystemImage creates the image file for config.target

func (Elemental) DeactivateDevices

func (e Elemental) DeactivateDevices() error

DeactivateDevice deactivates unmounted the block devices present within the system. Useful to deactivate LVM volumes, if any, related to the target device.

func (*Elemental) DeployImage

func (e *Elemental) DeployImage(img *v1.Image, leaveMounted bool) (info interface{}, err error)

DeployImage will deploy the given image into the target. This method creates the filesystem image file, mounts it and unmounts it as needed.

func (*Elemental) DumpSource

func (e *Elemental) DumpSource(target string, imgSrc *v1.ImageSource) (info interface{}, err error)

DumpSource sets the image data according to the image source type

func (Elemental) FindKernelInitrd

func (e Elemental) FindKernelInitrd(rootDir string) (kernel string, initrd string, err error)

FindKernelInitrd finds for kernel and intird files inside the /boot directory of a given root tree path. It assumes kernel and initrd files match certain file name prefixes.

func (*Elemental) FormatPartition

func (e *Elemental) FormatPartition(part *types.Partition, opts ...string) error

FormatPartition will format an already existing partition

func (*Elemental) GetIso

func (e *Elemental) GetIso(iso string) (tmpDir string, err error)

GetIso will try to: download the iso into a temporary folder and mount the iso file as loop in cnst.DownloadedIsoMnt

func (Elemental) MountImage

func (e Elemental) MountImage(img *v1.Image, opts ...string) error

MountImage mounts an image with the given mount options

func (Elemental) MountPartition

func (e Elemental) MountPartition(part *types.Partition, opts ...string) error

MountPartition mounts a partition with the given mount options

func (Elemental) MountPartitions

func (e Elemental) MountPartitions(parts types.PartitionList) error

MountPartitions mounts configured partitions. Partitions with an unset mountpoint are not mounted. Note umounts must be handled by caller logic.

func (Elemental) MountRWPartition

func (e Elemental) MountRWPartition(part *types.Partition) (umount func() error, err error)

MountRWPartition mounts, or remounts if needed, a partition with RW permissions

func (*Elemental) PartitionAndFormatDevice

func (e *Elemental) PartitionAndFormatDevice(i v1.SharedInstallSpec) error

PartitionAndFormatDevice creates a new empty partition table on target disk and applies the configured disk layout by creating and formatting all required partitions

func (*Elemental) SelinuxRelabel

func (e *Elemental) SelinuxRelabel(rootDir string, raiseError bool) error

SelinuxRelabel will relabel the system if it finds the binary and the context

func (Elemental) SetDefaultGrubEntry

func (e Elemental) SetDefaultGrubEntry(partMountPoint string, imgMountPoint string, defaultEntry string) error

SetDefaultGrubEntry Sets the default_menu_entry value in Config.GrubOEMEnv file at in State partition mountpoint. If there is not a custom value in the kairos-release file, we do nothing As the grub config already has a sane default

func (Elemental) UnmountImage

func (e Elemental) UnmountImage(img *v1.Image) error

UnmountImage unmounts the given image or does nothing if not mounted

func (Elemental) UnmountPartition

func (e Elemental) UnmountPartition(part *types.Partition) error

UnmountPartition unmounts the given partition or does nothing if not mounted

func (Elemental) UnmountPartitions

func (e Elemental) UnmountPartitions(parts types.PartitionList) error

UnmountPartitions unmounts configured partitiosn. Partitions with an unset mountpoint are not unmounted.

func (Elemental) UpdateSourcesFormDownloadedISO

func (e Elemental) UpdateSourcesFormDownloadedISO(workDir string, activeImg *v1.Image, recoveryImg *v1.Image) error

UpdateSourcesFormDownloadedISO checks a downaloaded and mounted ISO in workDir and updates the active and recovery image descriptions to use the squashed rootfs from the downloaded ISO.

Jump to

Keyboard shortcuts

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