bootloader

package
v3.1.0-alpha.20260901 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BootNone = "none"
	BootGrub = "grub"
)
View Source
const (
	OsReleasePath  = "/etc/os-release"
	Initrd         = "initrd"
	DefaultBootID  = "active"
	RecoveryBootID = "recovery"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootloader

type Bootloader interface {
	Install(i InstallCtx) error
	InstallLive(i InstallCtx) error
	Prune(rootPath, espDir string, keepEntryIDs []int) error
}

func New

func New(name string, s *sys.System) (Bootloader, error)

type Grub

type Grub struct {
	// contains filtered or unexported fields
}

func NewGrub

func NewGrub(s *sys.System, opts ...Option) *Grub

func (*Grub) Install

func (g *Grub) Install(i InstallCtx) error

Install installs the bootloader to the specified root.

func (*Grub) InstallLive

func (g *Grub) InstallLive(i InstallCtx) error

InstallLive installs the live bootloader to the specified target.

func (Grub) Prune

func (g Grub) Prune(rootPath, espDir string, keepSnapshotIDs []int) (err error)

Prune prunes old boot entries and artifacts not in the passed in keepSnapshotIDs.

type InstallCtx

type InstallCtx struct {
	// RootDir is the path for the root tree of the system to install the bootloader for. This path
	// is expected to be a full OS including the kernel, initrd and bootloader binaries at default
	// known locations.
	RootDir string

	// Target is the path where the bootloader binaries and configuration should be installed. This is
	// typically the mountpoint of the ESP partition.
	Target string

	// ESPLabel is the filesystem label of the ESP partition.
	ESPLabel string

	// EntryID this is the ID if the current bootloader entry to be installed.
	EntryID string

	// KernelCmdline is the full kernel command line we want to set for this specific entry.
	KernelCmdline string

	// RecKernelCmdline is the full kernel command line for the recovery entry, if any.
	RecKernelCmdline string

	// InitrdExtensions is the list of CPIO files to stack into the stock initrd. These CPIO files are mostly
	// used to inject additional setup into the stock initrd.
	InitrdExtensions []string
}

InstallCtx defines the parameters requierd by the bootloader to perform an installation

type None

type None struct {
	// contains filtered or unexported fields
}

func NewNone

func NewNone(s *sys.System) *None

func (*None) Install

func (n *None) Install(_ InstallCtx) error

func (*None) InstallLive

func (n *None) InstallLive(_ InstallCtx) error

func (*None) Prune

func (n *None) Prune(_, _ string, _ []int) error

type Option

type Option func(*Grub)

Jump to

Keyboard shortcuts

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