state

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

Functions

func DetectUKIboot added in v0.0.25

func DetectUKIboot(cmdline string) bool

Detects if we are on uki mode

func EfiBootFromInstall added in v0.0.25

func EfiBootFromInstall(logger zerolog.Logger) bool

EfiBootFromInstall will try to check the /sys/firmware/efi/LoaderDevicePartUUID-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f systemd vendor Id is 4a67b082-0a4c-41cf-b6c7-440b29bb8c4f and will never change LoaderDevicePartUUID contains the partition UUID of the EFI System Partition the boot loader was run from. Set by the boot loader. This will return true if we are running from a DISK device, which sets the efivar This wil return false when running from a volatile media, like CD or netboot as it cannot infer where it was booted from Useful to check if we are on install phase or not This efi var is VOLATILE so once we reboot is GONE. No way of keeping it across reboots, its set by the bootloader.

Types

type Boot

type Boot string
const (
	Active    Boot = "active_boot"
	Passive   Boot = "passive_boot"
	Recovery  Boot = "recovery_boot"
	LiveCD    Boot = "livecd_boot"
	AutoReset Boot = "autoreset_boot"
	Unknown   Boot = "unknown"

	UEFICurrentEntryFile = "/sys/firmware/efi/efivars/LoaderEntrySelected-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f"
)

func DetectBootWithVFS added in v0.0.14

func DetectBootWithVFS(fs types.KairosFS) (Boot, error)

DetectBootWithVFS will detect the boot state using a vfs so it can be used for tests as well

type FndMnt

type FndMnt struct {
	Filesystems []struct {
		Target    string `json:"target,omitempty"`
		FsOptions string `json:"fs-options,omitempty"`
	} `json:"filesystems,omitempty"`
}

type Kairos

type Kairos struct {
	Flavor     string         `yaml:"flavor" json:"flavor"`
	Version    string         `yaml:"version" json:"version"`
	Init       string         `yaml:"init" json:"init"`
	SecureBoot bool           `yaml:"secureboot" json:"secureboot"`
	EfiCerts   types.EfiCerts `yaml:"eficerts,omitempty" json:"eficerts,omitempty"`
}

type Lsblk added in v0.0.7

type Lsblk struct {
	BlockDevices []struct {
		Path       string `json:"path,omitempty"`
		Mountpoint string `json:"mountpoint,omitempty"`
		FsType     string `json:"fstype,omitempty"`
		Size       string `json:"size,omitempty"`
		Label      string `json:"label,omitempty"`
		RO         bool   `json:"ro,omitempty"`
	} `json:"blockdevices,omitempty"`
}

Lsblk is the struct to marshal the output of lsblk

type Machine

type Machine struct {
	BootArgs    []string
	CloudConfig string
}

type PartitionState

type PartitionState struct {
	Mounted         bool   `yaml:"mounted" json:"mounted"`
	Name            string `yaml:"name" json:"name"`
	Label           string `yaml:"label" json:"label"`
	FilesystemLabel string `yaml:"filesystemlabel" json:"filesystemlabel"`
	MountPoint      string `yaml:"mount_point" json:"mount_point"`
	SizeBytes       uint64 `yaml:"size_bytes" json:"size_bytes"`
	Type            string `yaml:"type" json:"type"`
	IsReadOnly      bool   `yaml:"read_only" json:"read_only"`
	Found           bool   `yaml:"found" json:"found"`
	UUID            string `yaml:"uuid" json:"uuid"` // This would be volume UUID on macOS, PartUUID on linux, empty on Windows
}

type Runtime

type Runtime struct {
	UUID       string          `yaml:"uuid" json:"uuid"`
	Persistent PartitionState  `yaml:"persistent" json:"persistent"`
	Recovery   PartitionState  `yaml:"recovery" json:"recovery"`
	OEM        PartitionState  `yaml:"oem" json:"oem"`
	State      PartitionState  `yaml:"state" json:"state"`
	BootState  Boot            `yaml:"boot" json:"boot"`
	System     sysinfo.SysInfo `yaml:"system" json:"system"`
	Kairos     Kairos          `yaml:"kairos" json:"kairos"`
}

func NewRuntime

func NewRuntime() (Runtime, error)

func NewRuntimeWithLogger added in v0.0.25

func NewRuntimeWithLogger(logger zerolog.Logger) (Runtime, error)

func (Runtime) Query

func (r Runtime) Query(s string) (res string, err error)

func (Runtime) String

func (r Runtime) String() string

type Spec

type Spec struct {
	MachineSpec Machine
}

Jump to

Keyboard shortcuts

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