grub

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: BSD-3-Clause Imports: 23 Imported by: 10

Documentation

Overview

Package grub implements a grub config file parser.

See the grub manual https://www.gnu.org/software/grub/manual/grub/ for a reference of the configuration format In particular the following pages: - https://www.gnu.org/software/grub/manual/grub/html_node/Shell_002dlike-scripting.html - https://www.gnu.org/software/grub/manual/grub/html_node/Commands.html

See parser.append function for list of commands that are supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConfigFile

func ParseConfigFile(ctx context.Context, s curl.Schemes, configFile string, root *url.URL, devices block.BlockDevices, mountPool *mount.Pool) ([]boot.OSImage, error)

ParseConfigFile parses a grub configuration as specified in https://www.gnu.org/software/grub/manual/grub/

See parser.append function for list of commands that are supported.

`root` is the default scheme, host, and path for any files named as a relative path - e.g. kernel and initramfs paths are requested relative to the root.

func ParseLocalConfig

func ParseLocalConfig(ctx context.Context, diskDir string, devices block.BlockDevices, mountPool *mount.Pool) ([]boot.OSImage, error)

ParseLocalConfig looks for a GRUB config in the disk partition mounted at diskDir and parses out OSes to boot.

Types

type EnvFile

type EnvFile struct {
	Vars map[string]string
}

EnvFile is a GRUB environment file consisting of key-value pairs akin to the GRUB commands load_env and save_env.

func NewEnvFile

func NewEnvFile() *EnvFile

NewEnvFile allocates a new env file.

func ParseEnvFile

func ParseEnvFile(r io.Reader) (*EnvFile, error)

ParseEnvFile reads a key-value pair GRUB environment file.

ParseEnvFile accepts incorrectly padded GRUB env files, as opposed to GRUB.

func (*EnvFile) WriteTo

func (env *EnvFile) WriteTo(w io.Writer) (int64, error)

WriteTo writes key-value pairs to a file, padded to 1024 bytes, as save_env does.

Jump to

Keyboard shortcuts

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