Documentation
¶
Overview ¶
Package bootloader provides a unified interface for bootloader management.
Index ¶
- type BootConfig
- type BootEntry
- type Bootloader
- type GRUB
- func (g *GRUB) Configure(ctx context.Context, rootPath string, cfg BootConfig) error
- func (g *GRUB) Install(ctx context.Context, rootPath, diskDevice string) error
- func (g *GRUB) ListEntries(_ context.Context, rootPath string) ([]BootEntry, error)
- func (g *GRUB) SetDefault(ctx context.Context, rootPath, title string) error
- type SystemdBoot
- func (s *SystemdBoot) Configure(_ context.Context, _ string, _ BootConfig) error
- func (s *SystemdBoot) Install(ctx context.Context, rootPath, _ string) error
- func (s *SystemdBoot) ListEntries(ctx context.Context, rootPath string) ([]BootEntry, error)
- func (s *SystemdBoot) SetDefault(ctx context.Context, rootPath, title string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootConfig ¶
BootConfig holds kernel parameters for bootloader configuration.
type Bootloader ¶
type Bootloader interface {
// Install sets up the bootloader on the target disk.
Install(ctx context.Context, rootPath, diskDevice string) error
// Configure sets kernel parameters and default entry.
Configure(ctx context.Context, rootPath string, cfg BootConfig) error
// ListEntries returns the available boot entries.
ListEntries(ctx context.Context, rootPath string) ([]BootEntry, error)
// SetDefault sets the default boot entry by title.
SetDefault(ctx context.Context, rootPath, title string) error
}
Bootloader defines operations for managing a bootloader.
func DetectBootloader ¶
func DetectBootloader(rootPath string) Bootloader
DetectBootloader examines rootPath and returns the appropriate Bootloader. It checks for the systemd-boot binary specifically; BOOTX64.EFI is not used because on most systems it is the shim loader (Secure Boot), not systemd-boot.
type GRUB ¶
type GRUB struct{}
GRUB manages GRUB2 bootloader installation and configuration.
func (*GRUB) ListEntries ¶
ListEntries returns parsed GRUB menu entries from grub.cfg.
type SystemdBoot ¶
type SystemdBoot struct{}
SystemdBoot manages systemd-boot bootloader.
func (*SystemdBoot) Configure ¶
func (s *SystemdBoot) Configure(_ context.Context, _ string, _ BootConfig) error
Configure is currently a no-op for systemd-boot (uses Type #1 BLS entries).
func (*SystemdBoot) Install ¶
func (s *SystemdBoot) Install(ctx context.Context, rootPath, _ string) error
Install installs systemd-boot into the ESP at rootPath.
func (*SystemdBoot) ListEntries ¶
ListEntries enumerates boot entries via bootctl.
func (*SystemdBoot) SetDefault ¶
func (s *SystemdBoot) SetDefault(ctx context.Context, rootPath, title string) error
SetDefault sets the default boot entry via bootctl.