Documentation ¶
Overview ¶
Package grub provides the interface to the GRUB bootloader: config management, installation, etc.
Package grub provides the interface to the GRUB bootloader: config management, installation, etc.
Package grub provides the interface to the GRUB bootloader: config management, installation, etc.
Index ¶
- func Quote(s string) string
- func Unquote(s string) string
- type BootLabel
- type Config
- func (c *Config) Encode(wr io.Writer) error
- func (c *Config) Install(options options.InstallOptions) error
- func (c *Config) PreviousLabel() string
- func (c *Config) Put(entry BootLabel, cmdline, version string) error
- func (c *Config) Revert(ctx context.Context) error
- func (c *Config) UEFIBoot() bool
- func (c *Config) Write(path string, printf func(string, ...any)) error
- type MenuEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Quote ¶ added in v1.4.0
Quote according to (incomplete) GRUB quoting rules.
See https://www.gnu.org/software/grub/manual/grub/html_node/Shell_002dlike-scripting.html
Types ¶
type BootLabel ¶
type BootLabel string
BootLabel represents a boot label, e.g. A or B.
const ( // ConfigPath is the path to the grub config. ConfigPath = constants.BootMountPoint + "/grub/grub.cfg" // BootA is a bootloader label. BootA BootLabel = "A" // BootB is a bootloader label. BootB BootLabel = "B" // BootReset is a bootloader label. BootReset BootLabel = "Reset" )
func ParseBootLabel ¶
ParseBootLabel parses the given human-readable boot label to a BootLabel.
type Config ¶
type Config struct { Default BootLabel Fallback BootLabel Entries map[BootLabel]MenuEntry AddResetOption bool }
Config represents a grub configuration file (grub.cfg).
func NewConfig ¶
func NewConfig() *Config
NewConfig creates a new grub configuration (nothing is written to disk).
func Probe ¶ added in v1.5.0
Probe probes a block device for GRUB bootloader.
If the 'disk' is passed, search happens on that disk only, otherwise searches all partitions.
func (*Config) Install ¶
func (c *Config) Install(options options.InstallOptions) error
Install validates the grub configuration and writes it to the disk.
func (*Config) PreviousLabel ¶ added in v1.5.0
PreviousLabel returns the previous bootloader label.