Documentation ¶
Index ¶
- Constants
- func DebugLevel() log.Level
- func IsDebugLevel(l Logger) bool
- type BuildConfig
- type CloudInitRunner
- type Config
- type FS
- type HTTPClient
- type Image
- type ImageMap
- type ImageSource
- type LiveISO
- type Logger
- type LoggerOptions
- type LuetInterface
- type Partition
- type PartitionList
- type RawDiskArchEntry
- type RawDiskPackage
- type RealRunner
- type RealSyscall
- type Repository
- type RunConfig
- type Runner
- type SourceNotFound
- type SyscallInterface
Constants ¶
const ( GPT = "gpt" ESP = "esp" BIOS = "bios_grub" MSDOS = "msdos" BOOT = "boot" )
Variables ¶
This section is empty.
Functions ¶
func DebugLevel ¶
func IsDebugLevel ¶
Types ¶
type BuildConfig ¶
type BuildConfig struct { ISO *LiveISO `yaml:"iso,omitempty" mapstructure:"iso"` Date bool `yaml:"date,omitempty" mapstructure:"date"` Name string `yaml:"name,omitempty" mapstructure:"name"` RawDisk map[string]*RawDiskArchEntry `yaml:"raw_disk,omitempty" mapstructure:"raw_disk"` OutDir string `yaml:"output,omitempty" mapstructure:"output"` // Generic runtime configuration Config `yaml:",inline" mapstructure:",squash"` }
BuildConfig represents the config we need for building isos, raw images, artifacts
type CloudInitRunner ¶
type Config ¶ added in v0.0.14
type Config struct { Logger Logger Fs FS Mounter mount.Interface Runner Runner Syscall SyscallInterface CloudInitRunner CloudInitRunner Luet LuetInterface Client HTTPClient Cosign bool `yaml:"cosign,omitempty" mapstructure:"cosign"` CosignPubKey string `yaml:"cosign-key,omitempty" mapstructure:"cosign-key"` LocalImage bool `yaml:"local,omitempty" mapstructure:"local"` Repos []Repository `yaml:"repositories,omitempty" mapstructure:"repositories"` Arch string `yaml:"arch,omitempty" mapstructure:"arch"` SquashFsCompressionConfig []string `yaml:"squash-compression,omitempty" mapstructure:"SquashFsCompressionConfig"` }
Config is the struct that includes basic and generic configuration of elemental binary runtime. It mostly includes the interfaces used around many methods in elemental code
type FS ¶ added in v0.0.14
type FS interface { Open(name string) (*os.File, error) Chmod(name string, mode os.FileMode) error Create(name string) (*os.File, error) Mkdir(name string, perm os.FileMode) error Stat(name string) (os.FileInfo, error) Lstat(name string) (os.FileInfo, error) RemoveAll(path string) error ReadFile(filename string) ([]byte, error) Readlink(name string) (string, error) RawPath(name string) (string, error) ReadDir(dirname string) ([]os.FileInfo, error) Remove(name string) error OpenFile(name string, flag int, perm fs.FileMode) (*os.File, error) WriteFile(filename string, data []byte, perm os.FileMode) error }
type HTTPClient ¶
type Image ¶
type Image struct { File string Label string Size uint FS string Source ImageSource MountPoint string LoopDevice string }
Image struct represents a file system image with its commonly configurable values, size in MiB
type ImageMap ¶
func (ImageMap) GetPassive ¶
func (ImageMap) GetRecovery ¶
func (ImageMap) SetPassive ¶
func (ImageMap) SetRecovery ¶
type ImageSource ¶
type ImageSource struct {
// contains filtered or unexported fields
}
ImageSource represents the source from where an image is created for easy identification
func NewChannelSrc ¶
func NewChannelSrc(src string) ImageSource
func NewDirSrc ¶
func NewDirSrc(src string) ImageSource
func NewDockerSrc ¶
func NewDockerSrc(src string) ImageSource
func NewEmptySrc ¶
func NewEmptySrc() ImageSource
func NewFileSrc ¶
func NewFileSrc(src string) ImageSource
func (ImageSource) IsChannel ¶
func (i ImageSource) IsChannel() bool
func (ImageSource) IsDir ¶
func (i ImageSource) IsDir() bool
func (ImageSource) IsDocker ¶
func (i ImageSource) IsDocker() bool
func (ImageSource) IsFile ¶
func (i ImageSource) IsFile() bool
func (ImageSource) Value ¶
func (i ImageSource) Value() string
type LiveISO ¶ added in v0.0.14
type LiveISO struct { RootFS []string `yaml:"rootfs,omitempty" mapstructure:"rootfs"` UEFI []string `yaml:"uefi,omitempty" mapstructure:"uefi"` Image []string `yaml:"image,omitempty" mapstructure:"image"` Label string `yaml:"label,omitempty" mapstructure:"label"` BootCatalog string `yaml:"boot_catalog,omitempty" mapstructure:"boot_catalog"` BootFile string `yaml:"boot_file,omitempty" mapstructure:"boot_file"` HybridMBR string `yaml:"hybrid_mbr,omitempty" mapstructure:"hybrid_mbr,omitempty"` }
LiveISO represents the configurations needed for a live ISO image
type Logger ¶
type Logger interface { Info(...interface{}) Warn(...interface{}) Debug(...interface{}) Error(...interface{}) Fatal(...interface{}) Panic(...interface{}) Trace(...interface{}) Infof(string, ...interface{}) Warnf(string, ...interface{}) Debugf(string, ...interface{}) Errorf(string, ...interface{}) Fatalf(string, ...interface{}) Panicf(string, ...interface{}) Tracef(string, ...interface{}) SetLevel(level log.Level) GetLevel() log.Level SetOutput(writer io.Writer) SetFormatter(formatter log.Formatter) }
Logger is the interface we want for our logger, so we can plug different ones easily
func NewBufferLogger ¶
NewBufferLogger will return a logger that stores all logs in a buffer, used mainly for testing
func NewNullLogger ¶
func NewNullLogger() Logger
NewNullLogger will return a logger that discards all logs, used mainly for testing
type LoggerOptions ¶
type LuetInterface ¶
type Partition ¶
type Partition struct { Label string Size uint Name string FS string Flags []string MountPoint string Path string Disk string }
Partition struct represents a partition with its commonly configurable values, size in MiB
type PartitionList ¶
type PartitionList []*Partition
func (PartitionList) GetByName ¶
func (pl PartitionList) GetByName(name string) *Partition
type RawDiskArchEntry ¶ added in v0.0.15
type RawDiskArchEntry struct { Repositories []Repository `yaml:"repo,omitempty"` Packages []RawDiskPackage `yaml:"packages,omitempty"` }
RawDiskArchEntry represents an arch entry in raw_disk
type RawDiskPackage ¶ added in v0.0.15
type RawDiskPackage struct { Name string `yaml:"name,omitempty"` Target string `yaml:"target,omitempty"` }
RawDiskPackage represents a package entry for raw_disk, with a package name and a target to install to
type RealRunner ¶
type RealRunner struct {
Logger Logger
}
func (RealRunner) GetLogger ¶ added in v0.0.14
func (r RealRunner) GetLogger() Logger
func (*RealRunner) SetLogger ¶ added in v0.0.14
func (r *RealRunner) SetLogger(logger Logger)
type RealSyscall ¶
type RealSyscall struct{}
func (*RealSyscall) Chdir ¶
func (r *RealSyscall) Chdir(path string) error
func (*RealSyscall) Chroot ¶
func (r *RealSyscall) Chroot(path string) error
type Repository ¶ added in v0.0.14
type Repository struct { Name string `yaml:"name,omitempty" mapstructure:"name"` Priority int `yaml:"priority,omitempty" mapstructure:"priority"` URI string `yaml:"uri,omitempty" mapstructure:"uri"` Type string `yaml:"type,omitempty" mapstructure:"type"` }
Repository represents the basic configuration for a package repository
type RunConfig ¶
type RunConfig struct { // Can come from config, env var or flags RecoveryLabel string `yaml:"RECOVERY_LABEL,omitempty" mapstructure:"RECOVERY_LABEL"` PersistentLabel string `yaml:"PERSISTENT_LABEL,omitempty" mapstructure:"PERSISTENT_LABEL"` StateLabel string `yaml:"STATE_LABEL,omitempty" mapstructure:"STATE_LABEL"` OEMLabel string `yaml:"OEM_LABEL,omitempty" mapstructure:"OEM_LABEL"` SystemLabel string `yaml:"SYSTEM_LABEL,omitempty" mapstructure:"SYSTEM_LABEL"` ActiveLabel string `yaml:"ACTIVE_LABEL,omitempty" mapstructure:"ACTIVE_LABEL"` PassiveLabel string `yaml:"PASSIVE_LABEL,omitempty" mapstructure:"PASSIVE_LABEL"` Target string `yaml:"target,omitempty" mapstructure:"target"` Source string `yaml:"source,omitempty" mapstructure:"source"` CloudInit string `yaml:"cloud-init,omitempty" mapstructure:"cloud-init"` ForceEfi bool `yaml:"force-efi,omitempty" mapstructure:"force-efi"` ForceGpt bool `yaml:"force-gpt,omitempty" mapstructure:"force-gpt"` PartLayout string `yaml:"partition-layout,omitempty" mapstructure:"partition-layout"` Tty string `yaml:"tty,omitempty" mapstructure:"tty"` NoFormat bool `yaml:"no-format,omitempty" mapstructure:"no-format"` Force bool `yaml:"force,omitempty" mapstructure:"force"` Strict bool `yaml:"strict,omitempty" mapstructure:"strict"` Iso string `yaml:"iso,omitempty" mapstructure:"iso"` DockerImg string `yaml:"docker-image,omitempty" mapstructure:"docker-image"` NoVerify bool `yaml:"no-verify,omitempty" mapstructure:"no-verify"` CloudInitPaths string `yaml:"CLOUD_INIT_PATHS,omitempty" mapstructure:"CLOUD_INIT_PATHS"` GrubDefEntry string `yaml:"GRUB_ENTRY_NAME,omitempty" mapstructure:"GRUB_ENTRY_NAME"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` ChannelUpgrades bool `yaml:"CHANNEL_UPGRADES,omitempty" mapstructure:"CHANNEL_UPGRADES"` UpgradeImage string `yaml:"UPGRADE_IMAGE,omitempty" mapstructure:"UPGRADE_IMAGE"` RecoveryImage string `yaml:"RECOVERY_IMAGE,omitempty" mapstructure:"RECOVERY_IMAGE"` LocalImage bool `yaml:"local,omitempty" mapstructure:"local"` RecoveryUpgrade bool // configured only via flag, no need to map it to any config ImgSize uint `yaml:"DEFAULT_IMAGE_SIZE,omitempty" mapstructure:"DEFAULT_IMAGE_SIZE"` Directory string `yaml:"directory,omitempty" mapstructure:"directory"` ResetPersistent bool `yaml:"reset-persistent,omitempty" mapstructure:"reset-persistent"` EjectCD bool `yaml:"eject-cd,omitempty" mapstructure:"eject-cd"` // Internally used to track stuff around PartTable string BootFlag string GrubConf string Partitions PartitionList Images ImageMap // Generic runtime configuration Config }
RunConfig is the struct that represents the full configuration needed for install, upgrade, reset, rebrand. Basically everything needed to know for all operations in a running system, not related to builds
type SourceNotFound ¶ added in v0.0.14
type SourceNotFound struct { }
SourceNotFound is the error to raise when we can't find a source for install/upgrade
func (*SourceNotFound) Error ¶ added in v0.0.14
func (s *SourceNotFound) Error() string