Documentation ¶
Index ¶
- type Elemental
- func (e *Elemental) CheckActiveDeployment(labels []string) bool
- func (e *Elemental) CopyCloudConfig(path string, cloudInit []string) (err error)
- func (e *Elemental) CopyFileImg(img *v1.Image) error
- func (e Elemental) CreateFileSystemImage(img *v1.Image) error
- func (e *Elemental) CreateImgFromTree(root string, img *v1.Image, noMount bool, cleaner func() error) (err error)
- func (e Elemental) CreatePreLoadedFileSystemImage(img *v1.Image, rootDir string) error
- func (e Elemental) DeactivateDevices() error
- func (e *Elemental) DeployImage(img *v1.Image) (interface{}, error)
- func (e *Elemental) DeployImgTree(img *v1.Image, root string) (info interface{}, cleaner func() error, err error)
- func (e *Elemental) DumpSource(target string, imgSrc *v1.ImageSource) (info interface{}, err error)
- func (e Elemental) FindKernelInitrd(rootDir string) (kernel string, initrd string, err error)
- func (e *Elemental) FormatPartition(part *v1.Partition, opts ...string) error
- func (e Elemental) MountImage(img *v1.Image, opts ...string) error
- func (e Elemental) MountPartition(part *v1.Partition, opts ...string) error
- func (e Elemental) MountPartitions(parts v1.PartitionList) error
- func (e Elemental) MountRWPartition(part *v1.Partition) (umount func() error, err error)
- func (e *Elemental) PartitionAndFormatDevice(i *v1.InstallSpec) error
- func (e *Elemental) SelinuxRelabel(rootDir string, raiseError bool) error
- func (e Elemental) SetDefaultGrubEntry(partMountPoint string, imgMountPoint string, defaultEntry string) error
- func (e Elemental) UnmountImage(img *v1.Image) error
- func (e Elemental) UnmountPartition(part *v1.Partition) error
- func (e Elemental) UnmountPartitions(parts v1.PartitionList) error
- func (e Elemental) UpdateSourceFormISO(iso string, activeImg *v1.Image) (func() error, error)
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 (*Elemental) CheckActiveDeployment ¶
CheckActiveDeployment returns true if at least one of the provided filesystem labels is found within the system
func (*Elemental) CopyCloudConfig ¶
CopyCloudConfig will check if there is a cloud init in the config and store it on the target
func (*Elemental) CopyFileImg ¶
CopyFileImg copies the files target as the source of this image. It also applies the img label over the copied image.
func (Elemental) CreateFileSystemImage ¶
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
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 ¶
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 ¶
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 ¶
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 ¶
FormatPartition will format an already existing partition
func (Elemental) MountImage ¶
MountImage mounts an image with the given mount options
func (Elemental) MountPartition ¶
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 ¶
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 ¶
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 ¶
UnmountImage unmounts the given image or does nothing if not mounted
func (Elemental) UnmountPartition ¶
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 ¶
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.