elemental

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

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 *v1.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(path string, cloudInit []string) (err error)

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

func (*Elemental) CopyFileImg

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

CopyFileImg copies the files target as the source of this image. It also applies the img label over the copied image.

func (Elemental) CreateFileSystemImage

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

CreateFileSystemImage creates the image file for the given image

func (*Elemental) CreateImgFromTree

func (e *Elemental) CreateImgFromTree(root string, img *v1.Image, noMount bool, cleaner func() error) (err error)

CreateImgFromTree creates the given image from with the contents of the tree for the given root. NoMount flag allows formatting an image including its contents (experimental and ext* specific)

func (Elemental) CreatePreLoadedFileSystemImage added in v1.1.0

func (e Elemental) CreatePreLoadedFileSystemImage(img *v1.Image, rootDir string) error

CreatePreLoadedFileSystemImage creates the image file for the given image including the contents of the rootDir. If rootDir is empty it simply creates an empty filesystem image

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) (interface{}, error)

DeployImage will deploy the given image into the target. This method creates the filesystem image file and fills it with the correspondant data

func (*Elemental) DeployImgTree

func (e *Elemental) DeployImgTree(img *v1.Image, root string) (info interface{}, cleaner func() error, err error)

DeployImgTree will deploy the given image into the given root tree. Returns source metadata in info, a tree cleaner function and error. The given root will be a bind mount of a temporary directory into the same filesystem of img.File, this is helpful to make the deployment easily accessible in after-* hooks.

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 *v1.Partition, opts ...string) error

FormatPartition will format an already existing partition

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 *v1.Partition, opts ...string) error

MountPartition mounts a partition with the given mount options

func (Elemental) MountPartitions

func (e Elemental) MountPartitions(parts v1.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 *v1.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.InstallSpec) 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_meny_entry value in RunConfig.GrubOEMEnv file at in State partition mountpoint. If there is not a custom value in the os-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 *v1.Partition) error

UnmountPartition unmounts the given partition or does nothing if not mounted

func (Elemental) UnmountPartitions

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

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

func (Elemental) UpdateSourceFormISO

func (e Elemental) UpdateSourceFormISO(iso string, activeImg *v1.Image) (func() error, error)

UpdateSourceISO downloads an ISO in a temporary folder, mounts it and updates active image to use the ISO squashfs image as source. Returns a cleaner method to unmount and remove the temporary folder afterwards.

Jump to

Keyboard shortcuts

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