Documentation
¶
Index ¶
- Constants
- func Build(path string, nameservers, dnsSearch, dnsOptions []string) error
- func Commands(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func DNS(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func DataSources(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func DecodeMultipartVmware(data []byte) []byte
- func DeleteEntities(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Download(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func EnsureDirectories(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func EnsureFiles(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Entities(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Environment(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Git(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Hostname(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func IfArch(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func IfConditional(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func IfFiles(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func IfServiceManager(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Layout(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func LoadModules(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func MiBToSectors(size uint64, sectorSize uint64) uint64
- func NodeConditional(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func OnlyIfOS(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func OnlyIfOSVersion(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Packages(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func SSH(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Sysctl(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func SystemHostname(hostname string, fs vfs.FS) error
- func Systemctl(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func SystemdFirstboot(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func Timesyncd(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func UnpackImage(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- func UpdateHostsFile(hostname string, fs vfs.FS) error
- func User(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error
- type Console
- type Disk
- func (dev *Disk) AddPartitions(fs vfs.FS, parts []schema.Partition, l logger.Interface, console Console) error
- func (dev *Disk) CheckDiskFreeSpaceMiB(minSpace uint64) bool
- func (dev *Disk) ExpandLastPartition(fs vfs.FS, size uint64, console Console) error
- func (dev *Disk) MatchPartitionFSLabel(label string) bool
- func (dev *Disk) MatchPartitionPLabel(label string) bool
- type Distro
- type FilesystemDetector
- type GrowFsToMaxInterface
- type Installer
- type MkfsCall
- type Partition
- type RealFilesystemDetector
- type RealGrowFsToMax
Constants ¶
const ( OneMiBInBytes = 1024 * 1024 Ext4 = "ext4" Ext3 = "ext3" Ext2 = "ext2" Fat = "fat" Vfat = "vfat" Fat32 = "fat32" Fat16 = "fat16" Xfs = "xfs" Btrfs = "btrfs" Swap = "swap" )
const ( // BLKGETSIZE64 returns u64 device size in bytes when called on a block device fd. BLKGETSIZE64 = 0x80081272 // EXT4_IOC_RESIZE_FS precomputed value for 64-bit Linux (x86_64, arm64, riscv64, ppc64le) // Otherwise make a IOW('f', 16, __u64) -> 0x40086610 // https://github.com/torvalds/linux/blob/master/include/uapi/linux/ext4.h#L26 EXT4_IOC_RESIZE_FS = 0x40086610 // XFS_IOC_FSGROWFSDATA = _IOW('X', 110, struct xfs_growfs_data) -> size=16 -> 0x4010586e // https://github.com/torvalds/linux/blob/master/fs/xfs/libxfs/xfs_fs.h#L1059 XFS_IOC_FSGROWFSDATA = 0x4010586e // BTRFS_IOC_RESIZE = _IOW(0x94, 3, struct btrfs_ioctl_vol_args) -> size=4096 -> 0x50009403 // https://github.com/torvalds/linux/blob/master/include/uapi/linux/btrfs.h#L1106 BTRFS_IOC_RESIZE = 0x50009403 )
const ( ErrorEmptyOverrideService = "Skipping empty override service" ErrorEmptyOverrideContent = "Empty override content for %s" DefaultOverrideName = "override-yip.conf" DefaultOverrideDir = "/etc/systemd/system/%s.d" DefaultServiceExt = ".service" DefaultOverrideExt = ".conf" EmptyString = "" )
const RunOnlyOs = "running stage (OnlyIfOs regex (%s)"
const RunOnlyOsVersion = "running stage (OnlyIfOsVersion regex (%s)"
const SkipBothServices = "both systemd and openrc are available, cant filter"
const SkipNotSupportedServiceManager = "service manager %s is not supported"
const SkipOnlyArch = "arch %s doesn't match %s"
const SkipOnlyOs = "OnlyIfOs regex (%s)"
const SkipOnlyOsVersion = "OnlyIfOsVersion regex (%s)"
const SkipOnlyServiceManager = "service manager doesn't match %s"
Variables ¶
This section is empty.
Functions ¶
func DataSources ¶
func DecodeMultipartVmware ¶ added in v1.3.1
DecodeMultipartVmware will try to decode the user-data from VMWARE provider as it returns a multipart/mixed data instead of the simple cloud-config
func DeleteEntities ¶
func EnsureDirectories ¶
func EnsureFiles ¶
func Environment ¶
func IfArch ¶ added in v1.14.1
IfArch checks if the current architecture matches the one specified in the stage Only runs if the regex matches the current architecture
func IfConditional ¶
func IfServiceManager ¶ added in v1.14.1
IfServiceManager checks if the current service manager matches the one specified in the stage Only runs if the service manager matches the specified service manager
func LoadModules ¶
func MiBToSectors ¶
func NodeConditional ¶
func OnlyIfOS ¶ added in v1.14.0
OnlyIfOS checks if the OS matches the if statement and runs it if so
func OnlyIfOSVersion ¶ added in v1.14.0
OnlyIfOSVersion checks if the OS VERSION matches the if statement and runs it if so
func Packages ¶ added in v1.13.0
Packages runs the package manager to try to install/remove/upgrade/refresh packages It will try to identify the package manager based on the distro If it can't identify the package manager, it will return an error Order is Refresh -> Upgrade -> Install -> Remove
func SystemdFirstboot ¶
func UnpackImage ¶ added in v1.14.0
Types ¶
type Disk ¶
func FindDiskFromLabel ¶ added in v1.19.0
func (*Disk) AddPartitions ¶ added in v1.19.0
func (*Disk) CheckDiskFreeSpaceMiB ¶
func (*Disk) ExpandLastPartition ¶
func (*Disk) MatchPartitionFSLabel ¶ added in v1.19.0
func (*Disk) MatchPartitionPLabel ¶ added in v1.19.0
type Distro ¶ added in v1.13.0
type Distro string
const ( Debian Distro = "debian" Ubuntu Distro = "ubuntu" RedHat Distro = "rhel" CentOS Distro = "centos" RockyLinux Distro = "rocky" AlmaLinux Distro = "almalinux" Fedora Distro = "fedora" Arch Distro = "arch" Alpine Distro = "alpine" OpenSUSELeap Distro = "opensuse-leap" OpenSUSETumbleweed Distro = "opensuse-tumbleweed" SUSE Distro = "suse" OpenEuler Distro = "openEuler" )
type FilesystemDetector ¶ added in v1.19.0
type FilesystemDetector interface {
DetectFileSystemType(part *gpt.Partition, d *disk.Disk) (string, error)
}
FilesystemDetector allows mocking filesystem detection in tests.
var DefaultFilesystemDetector FilesystemDetector = RealFilesystemDetector{}
type GrowFsToMaxInterface ¶ added in v1.19.0
GrowFsToMaxInterface defines an interface for growing filesystems to max size.
var DefaultGrowFsToMax GrowFsToMaxInterface = &RealGrowFsToMax{}
DefaultGrowFsToMax is the default instance of GrowFsToMaxInterface.
type Partition ¶
type RealFilesystemDetector ¶ added in v1.19.0
type RealFilesystemDetector struct{}
RealFilesystemDetector implements FilesystemDetector using real detection logic.
func (RealFilesystemDetector) DetectFileSystemType ¶ added in v1.19.0
type RealGrowFsToMax ¶ added in v1.19.0
type RealGrowFsToMax struct{}
RealGrowFsToMax is the real implementation of GrowFsToMaxInterface.
func (*RealGrowFsToMax) GrowFSToMax ¶ added in v1.19.0
func (r *RealGrowFsToMax) GrowFSToMax(devicePath, fsType string) error
GrowFSToMax grows the filesystem on the given block device path to the maximum available space in the partition. fsType: "ext4" (works for ext3/ext2 via ext4 driver), "xfs", "btrfs".
Source Files
¶
- commands.go
- common.go
- datasource.go
- dir.go
- dns.go
- download.go
- entities.go
- environment.go
- file_decoder.go
- file_gzip_decoder.go
- files.go
- files_base64_decoder.go
- git.go
- hostname.go
- if.go
- if_arch.go
- if_files_dirs.go
- if_os.go
- if_service_manager.go
- layout.go
- layout_resizer.go
- modules.go
- network.go
- packages.go
- ssh.go
- sysctl.go
- systemctl.go
- systemd_firstboot.go
- timesyncd.go
- unpack_image.go
- user.go