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(opts options.InstallOptions) (*options.InstallResult, error)
- func (c *Config) Put(entry BootLabel, cmdline, version string) error
- func (c *Config) RequiredPartitions() []partition.Options
- func (c *Config) Revert(disk string) error
- 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
func Probe(disk string, options options.ProbeOptions) (*Config, error)
Probe probes a block device for GRUB bootloader.
func ProbeWithCallback ¶ added in v1.8.0
func ProbeWithCallback(disk string, options options.ProbeOptions, callback func(*Config) error) (*Config, error)
ProbeWithCallback probes the GRUB bootloader, and calls the callback function with the Config.
func (*Config) Install ¶
func (c *Config) Install(opts options.InstallOptions) (*options.InstallResult, error)
Install validates the grub configuration and writes it to the disk.
func (*Config) RequiredPartitions ¶ added in v1.8.0
RequiredPartitions returns the list of partitions required by the bootloader.