Documentation ¶
Overview ¶
Package menu displays a Terminal UI based text menu to choose boot options from.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtendedLabel ¶
ExtendedLabel calls Entry.String(), but falls back to Entry.Label(). Shortly before kexec, "Attempting to boot %s" is printed. This allows for multiple lines of information which would not otherwise fit in the menu.
func NewTerminal ¶
NewTerminal opens an xTerminal using the given file input. Note that the xterm is in raw mode. Write \r\n whenever you would write a \n. When testing in qemu, it might look fine because there might be another tty cooking the newlines. In for example minicom, the behavior is different. And you would see something like:
Select a boot option to edit: >
Instead of:
Select a boot option to edit: >
func SetInitialTimeout ¶
SetInitialTimeout sets the initial timeout of the menu to the provided duration
Types ¶
type Entry ¶
type Entry interface { // Label is the string displayed to the user in the menu. It must be a // single line to fit in the menu. Label() string // Edit the kernel command line if possible. Must be called prior to // Load. Edit(func(cmdline string) string) // Load is called when the entry is chosen, but does not transfer // execution to another process or kernel. Load() error // Exec transfers execution to another process or kernel. // // Exec either returns an error or does not return at all. Exec() error // IsDefault indicates that this action should be run by default if the // user didn't make an entry choice. IsDefault() bool }
Entry is a menu entry.
func Choose ¶
func Choose(term MenuTerminal, allowEdit bool, entries ...Entry) Entry
Choose presents the user a menu on input to choose an entry from and returns that entry. Note: This call can block if MenuTerminal or the underlying os.File does
not support SetTimeout/SetDeadline.
func ShowMenuAndLoad ¶
ShowMenuAndLoad calls showMenuAndLoadFromFile using the default tty. Use TTY because os.stdin does not support deadlines well.
type MenuTerminal ¶
type OSImageAction ¶
OSImageAction is a menu.Entry that boots an OSImage.
func (OSImageAction) IsDefault ¶
func (OSImageAction) IsDefault() bool
IsDefault returns true -- this action should be performed in order by default if the user did not choose a boot entry.
func (OSImageAction) Load ¶
func (oia OSImageAction) Load() error
Load implements Entry.Load by loading the OS image into memory.
type Reboot ¶
type Reboot struct{}
Reboot is a menu.Entry that reboots the machine.
type StartShell ¶
type StartShell struct{}
StartShell is a menu.Entry that starts a LinuxBoot shell.
func (StartShell) Exec ¶
func (StartShell) Exec() error
Exec implements Entry.Exec by running /bin/defaultsh.
func (StartShell) IsDefault ¶
func (StartShell) IsDefault() bool
IsDefault indicates that this should not be run as a default action.