Documentation ¶
Index ¶
- func ApplySELinuxLabels(c types.Config, rootDir string, bind map[string]string) (err error)
- func CheckActiveDeployment(cfg types.Config) bool
- func CopyCloudConfig(c types.Config, path string, cloudInit []string) (err error)
- func CopyFileImg(c types.Config, img *types.Image) error
- func CreateFileSystemImage(c types.Config, img *types.Image, rootDir string, preload bool, ...) error
- func CreateImageFromTree(c types.Config, img *types.Image, rootDir string, preload bool, ...) (err error)
- func DeactivateDevices(c types.Config) error
- func DeployRecoverySystem(cfg types.Config, img *types.Image) error
- func DumpSource(c types.Config, target string, imgSrc *types.ImageSource, ...) error
- func FormatPartition(c types.Config, part *types.Partition, opts ...string) error
- func GetTempDir(c types.Config, suffix string) string
- func IsActiveMode(cfg types.Config) bool
- func IsMounted(c types.Config, part *types.Partition) (bool, error)
- func IsPassiveMode(cfg types.Config) bool
- func IsRWMountPoint(r types.Runner, mountPoint string) (bool, error)
- func IsRecoveryMode(cfg types.Config) bool
- func MirrorRoot(c types.Config, target string, imgSrc *types.ImageSource) error
- func MountFileSystemImage(c types.Config, img *types.Image, opts ...string) error
- func MountPartition(c types.Config, part *types.Partition, opts ...string) error
- func MountPartitions(c types.Config, parts types.PartitionList, overwriteFlags ...string) error
- func MountRWPartition(c types.Config, part *types.Partition) (umount func() error, err error)
- func PartitionAndFormatDevice(c types.Config, i *types.InstallSpec) error
- func SelinuxRelabel(c types.Config, rootDir string, extraPaths ...string) error
- func SourceFormISO(c types.Config, iso string) (*types.ImageSource, func() error, error)
- func UnmountFileSystemImage(c types.Config, img *types.Image) error
- func UnmountPartition(c types.Config, part *types.Partition) error
- func UnmountPartitions(c types.Config, parts types.PartitionList) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplySELinuxLabels ¶ added in v2.2.0
ApplySELinuxLabels relables with setfiles the given root in a chroot env. Additionaly after the first chrooted call it runs a non chrooted call to relabel any mountpoint used within the chroot.
func CheckActiveDeployment ¶
CheckActiveDeployment returns true if at least one of the mode sentinel files is found
func CopyCloudConfig ¶
CopyCloudConfig will check if there is a cloud init in the config and store it on the target
func CopyFileImg ¶
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 ¶
DeactivateDevice deactivates unmounted the block devices present within the system. Useful to deactivate LVM volumes, if any, related to the target device.
func DeployRecoverySystem ¶ added in v2.1.0
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, syncFunc func( l types.Logger, r types.Runner, f types.FS, src string, dst string, excl ...string, ) error, ) error
DumpSource dumps the imgSrc data to target. SyncFunc argument is the function used to synchronize file or directory sources (unused for contaier images), defaults to utils.SyncData if nil provided.
func FormatPartition ¶
FormatPartition will format an already existing partition
func GetTempDir ¶
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 ¶
IsActiveMode checks if the active mode sentinel file exists
func IsPassiveMode ¶
IsPassiveMode checks if the passive mode sentinel file exists
func IsRecoveryMode ¶
IsRecoveryMode checks if the recovery mode sentinel file exists
func MirrorRoot ¶ added in v2.1.1
MirrorRoot mirrors image source contents to target. Any preexisting data in target is going to be overwritten or deleted to perfectly match image source contents.
func MountFileSystemImage ¶
MountFileSystemImage mounts an image with the given mount options
func MountPartition ¶
MountPartition mounts a partition with the given mount options
func MountPartitions ¶
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 ¶
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 ¶
SelinuxRelabel will relabel the system if it finds the binary and the context
func SourceFormISO ¶
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 ¶
UnmountFilesystemImage unmounts the given image or does nothing if not mounted
func UnmountPartition ¶
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.