elemental

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySelinuxLabels

func ApplySelinuxLabels(cfg types.Config, parts types.ElementalPartitions) error

ApplySelinuxLabels sets SELinux extended attributes to the root-tree being installed

func CheckActiveDeployment

func CheckActiveDeployment(cfg types.Config) bool

CheckActiveDeployment returns true if at least one of the mode sentinel files is found

func CopyCloudConfig

func CopyCloudConfig(c types.Config, 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 CopyFileImg

func CopyFileImg(c types.Config, img *types.Image) error

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

func CreateFileSystemImage

func CreateFileSystemImage(c types.Config, img *types.Image, rootDir string, preload bool, excludes ...string) error

CreateFileSystemImage creates the image file for the given image. An root tree path can be used to determine the image size and the preload flag can be used to create an image including the root tree data.

func CreateImageFromTree

func CreateImageFromTree(c types.Config, img *types.Image, rootDir string, preload bool, cleaners ...func() error) (err error)

CreateImageFromTree creates the given image including the given root tree. If preload flag is true it attempts to preload the root tree at filesystem format time. This allows creating images with the given root tree without the need of mounting them.

func DeactivateDevices

func DeactivateDevices(c types.Config) error

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

func DeployImage

func DeployImage(c types.Config, img *types.Image) 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 DeployRecoverySystem added in v2.1.0

func DeployRecoverySystem(cfg types.Config, img *types.Image) error

DeployRecoverySystem deploys the rootfs image from the img parameter and extracts kernel+initrd to the same directory. This can be used for both ISO (all artifacts in same output dir) and raw disks (kernel and initrd in ESP, rootfs squashfs image in recovery partition.

func DumpSource

func DumpSource(c types.Config, target string, imgSrc *types.ImageSource) error

DumpSource sets the image data according to the image source type

func FormatPartition

func FormatPartition(c types.Config, part *types.Partition, opts ...string) error

FormatPartition will format an already existing partition

func GetTempDir

func GetTempDir(c types.Config, suffix string) string

GetTempDir returns the dir for storing related temporal files It will respect TMPDIR and use that if exists, fallback to try the persistent partition if its mounted and finally the default /tmp/ dir suffix is what is appended to the dir name elemental-suffix. If empty it will randomly generate a number

func IsActiveMode

func IsActiveMode(cfg types.Config) bool

IsActiveMode checks if the active mode sentinel file exists

func IsMounted

func IsMounted(c types.Config, part *types.Partition) (bool, error)

Is Mounted checks if the given partition is mounted or not

func IsPassiveMode

func IsPassiveMode(cfg types.Config) bool

IsPassiveMode checks if the passive mode sentinel file exists

func IsRWMountPoint

func IsRWMountPoint(c types.Config, mountPoint string) (bool, error)

func IsRecoveryMode

func IsRecoveryMode(cfg types.Config) bool

IsRecoveryMode checks if the recovery mode sentinel file exists

func MountFileSystemImage

func MountFileSystemImage(c types.Config, img *types.Image, opts ...string) error

MountFileSystemImage mounts an image with the given mount options

func MountPartition

func MountPartition(c types.Config, part *types.Partition, opts ...string) error

MountPartition mounts a partition with the given mount options

func MountPartitions

func MountPartitions(c types.Config, parts types.PartitionList, overwriteFlags ...string) error

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

func MountRWPartition

func MountRWPartition(c types.Config, part *types.Partition) (umount func() error, err error)

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

func PartitionAndFormatDevice

func PartitionAndFormatDevice(c types.Config, i *types.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 SelinuxRelabel

func SelinuxRelabel(c types.Config, rootDir string, raiseError bool) error

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

func SourceFormISO

func SourceFormISO(c types.Config, iso string) (*types.ImageSource, func() error, error)

SourceISO downloads an ISO in a temporary folder, mounts it and returns the image source to be used Returns a source and cleaner method to unmount and remove the temporary folder afterwards.

func UnmountFileSystemImage

func UnmountFileSystemImage(c types.Config, img *types.Image) error

UnmountFilesystemImage unmounts the given image or does nothing if not mounted

func UnmountPartition

func UnmountPartition(c types.Config, part *types.Partition) error

UnmountPartition unmounts the given partition or does nothing if not mounted

func UnmountPartitions

func UnmountPartitions(c types.Config, parts types.PartitionList) error

UnmountPartitions unmounts configured partitions. Partitions with an unset mountpoint are ignored. Already unmounted partitions are also ignored.

Types

This section is empty.

Jump to

Keyboard shortcuts

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