MENUSETS.4TH(8)
πΈ MENUSETS.4TH(8) πΈ
System Manager's Manual Β· menusets.4th β FreeBSD dynamic submenu boot module
π NAME π
menusets.4th β FreeBSD dynamic submenu boot module
β¨ DESCRIPTION β¨
Okay so bestie, the file that goes by the name of menusets.4th is a set of commands designed to add submenu functionality to the dynamic menu system provided by menu.4th(8). Submenus are managed through a system of carefully named environment variables. The commands of menusets.4th by themselves are not enough for most uses β please refer to the examples below for the most common situations, and to menu.4th(8) for additional commands. Periodt.
Before using any of the commands provided in menusets.4th, it must be included through the command:
include menusets.4th
This line is present in the default /boot/menu-commands.4th file, so it is not needed (and should not be re-issued) in a normal setup. Do not come for that line, bestie β it is already handled.
The commands provided by it are:
menuset-loadsetnumβ Takes a single integer on the stack to identify the menuset environment variables to be activated (see environment variables below).menuset-loadinitialβ If$menuset_initialis set, passes the value tomenuset-loadsetnum. The value must be a number.menusets-unsetβ Unsets the environment variables associated with all menusets. Increments starting at 1 and stops at the first unconfigured menuset. A menuset is considered configured if the caption for item 1 is set.
The environment variables that affect its behavior are:
menuset_initialβ Number to pass tomenuset-loadsetnumwhenmenuset-loadinitialis called.menuset_nameNβ Used to give a name to a menuset.
When a menuset is NOT given a name (the default), menuset N is comprised of the following environment variables:
ansisetN_caption[x] -> ansi_caption[x]
ansisetN_caption[x][y] -> ansi_caption[x][y]
menusetN_acpi -> menu_acpi
menusetN_caption[x] -> menu_caption[x]
menusetN_caption[x][y] -> menu_caption[x][y]
menusetN_command[x] -> menu_command[x]
menusetN_init -> βevaluatedβ
menusetN_init[x] -> menu_init[x]
menusetN_keycode[x] -> menu_keycode[x]
menusetN_options -> menu_options
menusetN_optionstext -> menu_optionstext
menusetN_reboot -> menu_reboot
toggledsetN_ansi[x] -> toggled_ansi[x]
toggledsetN_text[x] -> toggled_text[x]
When you choose to give a menuset a name (by setting $menuset_nameN), menuset N is instead comprised of the following environment variables:
NAMEansi_caption[x] -> ansi_caption[x]
NAMEansi_caption[x][y] -> ansi_caption[x][y]
NAMEmenu_acpi -> menu_acpi
NAMEmenu_caption[x] -> menu_caption[x]
NAMEmenu_caption[x][y] -> menu_caption[x][y]
NAMEmenu_command[x] -> menu_command[x]
NAMEmenu_init -> βevaluatedβ
NAMEmenu_init[x] -> menu_init[x]
NAMEmenu_keycode[x] -> menu_keycode[x]
NAMEmenu_options -> menu_options
NAMEmenu_optionstext -> menu_optionstext
NAMEmenu_reboot -> menu_reboot
NAMEtoggled_ansi[x] -> toggled_ansi[x]
NAMEtoggled_text[x] -> toggled_text[x]
where NAME is the value of $menuset_nameN. In the case of $NAMEmenu_init ($menusetN_init when $menuset_nameN is unset), the value is evaluated as an FICL statement. This can be used to dynamically adjust the menuset variables right before the menu is activated. Literally right before the menu pops off.
In addition, menusets.4th provides the following FICL words:
menuset-checksetnum (N --)β Given a single integer on the stack, sets a global variablemenuset_use_nameto a boolean based on whether$menuset_nameNis set (true) or not (false). Also sets$affixtemporary variable (prefix or infix depending onmenuset_use_name). Automatically called bymenuset-loadsetnumandmenusets-unset.menuset-loadvar (--)β Used indirectly to shorten syntax and mitigate dictionary size. Requires the following temporary environment variables:typeshould be set to one of:menutoggledansi;varshould be set to one of:captioncommandkeycodetext...;affixeither a prefix (menuset_use_nameis true) or infix (menuset_use_nameis false). If the globalmenuset_use_nameis true, the variable${type}_${var}is made to equal the value of the variable${affix}${type}_${var}(note: in this casemenuset-checksetnumhas set$affixto$menuset_nameN). Otherwise (whenmenuset_use_nameis false), the variable${type}_${var}is made to equal the value of the variable${type}set${affix}_${var}(note: in this casemenuset-checksetnumhas set$affixtoN). Both the global variablemenuset_use_nameand the environment variable$affixare automatically handled bymenuset-checksetnumabove (which is automatically called bymenuset-loadsetnum).menuset-unloadvar (--)β Used indirectly to shorten syntax and mitigate dictionary size. Likemenuset-loadvarexcept it unsets the menuset variable. If globalmenuset_use_nameis true ($affixis$menuset_nameN), variable${affix}${type}_${var}is unset. Otherwise,$affixisNand variable${type}set${affix}_${var}is unset.menuset-loadmenuvar (--)β Sets$typetomenuand callsmenuset-loadvar.menuset-unloadmenuvar (--)β Sets$typetomenuand callsmenuset-unloadvar.menuset-loadxvar (--)β Likemenuset-loadvarexcept it takes an additional temporary variable$x. If the globalmenuset_use_nameis true (making$affixequal$menuset_nameN), sets variable${type}_${var}[${x}]to variable${affix}${type}_${var}[${x}]. Otherwise ($affixbeingN), sets the same variable to instead${type}set{affix}_${var}[${x}].menuset-unloadxvar (--)β Likemenuset-loadxvarexcept it unsets the menuset variable. If globalmenuset_use_nameis true, unsets${affix}${type}_${var}[${x}]. Otherwise, unsets${type}set${affix}_${var}[${x}].menuset-loadansixvar (--)β Sets$typetoansiand callsmenuset-loadxvar.menuset-unloadansixvar (--)β Sets$typetoansiand callsmenuset-unloadxvar.menuset-loadmenuxvar (--)β Sets$typetoansiand callsmenuset-loadxvar.menuset-unloadmenuxvar (--)β Sets$typetoansiand callsmenuset-unloadxvar.menuset-loadtoggledxvar (--)β Sets$typetotoggledand callsmenuset-loadxvar.menuset-unloadtoggledxvar (--)β Sets$typetotoggledand callsmenuset-unloadxvar.menuset-loadxyvar (--)β Likemenuset-loadxvarexcept it takes an additional temporary variable$y. If the globalmenuset_use_nameis true ($affixis$menuset_nameN), sets variable${type}_${var}[${x}][${y}]to${affix}${type}_${var}[${x}][${y}]. Otherwise ($affixisN) sets the same variable to instead${type}set${affix}_${var}[${x}][${y}].menuset-unloadxyvar (--)β Likemenuset-loadxyvarexcept it unsets the menuset variable. If the globalmenuset_use_nameis true, unsets${affix}${type}_${var}[${x}][${y}]. Otherwise, unsets${type}set${affix}_${var}[${x}][${y}].menuset-loadansixyvar (--)β Sets$typetoansiand callsmenuset-loadxyvar.menuset-unloadansixyvar (--)β Sets$typetoansiand callsmenuset-unloadxyvar.menuset-loadmenuxyvar (--)β Sets$typetomenuand callsmenuset-loadxyvar.menuset-unloadmenuxyvar (--)β Sets$typetomenuand callsmenuset-unloadxyvar.menuset-setnum-namevar (N -- C-Addr/U)β Takes a single integer on the stack and replaces it with a string (in c-addr/u format) whose value ismenuset_nameN. For example, if given 1 returnsmenuset_name1.menuset-cleanup (N --)β Unsets all the various temporary variables, currentlytype,var,x,y, andaffix.
For all values of x above, use any number between 1 through 9. Sorry, double-digits are not currently supported. For all values of N above, use any number between 1 and 65535. Those are the rules, bestie.
π FILES π
/boot/loaderβ Theloader(8)./boot/menu.4thβ Dynamic menu module./boot/menu-commands.4thβ Contains thegoto_menucommand./boot/menusets.4thβmenusets.4thitself./boot/loader.rcβloader(8)bootstrapping script.
π¦ EXAMPLES π¦
A simple boot menu with a submenu:
include /boot/menu.4th
include /boot/menu-commands.4th
menu-init
set menuset1_caption[1]="Boot"
set menuset1_command[1]="boot"
set menuset1_caption[2]="Submenu..."
set menuset1_command[2]="2 goto_menu"
set menuset2_caption[1]="Back"
set menuset2_command[1]="1 goto_menu"
set menuset_initial=2
menuset-loadinitial
menu-display
The same boot menu with named menusets:
include /boot/menu.4th
include /boot/menu-commands.4th
menu-init
set menuset_name1=main
set mainmenu_caption[1]="Boot"
set mainmenu_command[1]="boot"
set mainmenu_caption[2]="Submenu..."
set mainmenu_command[2]="2 goto_menu"
set menuset_name2=sub
set submenu_caption[1]="Back"
set submenu_command[1]="1 goto_menu"
π SEE ALSO π
loader.conf(5), beastie.4th(8), loader(8), loader.4th(8), menu.4th(8)
β HISTORY β
The menusets.4th set of commands first appeared in FreeBSD 10.0.
π AUTHORS π
okay so credit where credit is due bestie, because somebody actually built all of this π
The whole menusets.4th set of commands was written by Devin Teske <dteske@FreeBSD.org> β yes, that's a real email, yes you can literally write to the person who made the thing, no cap π«Ά
Like, every menu, every command in this set? That's them. Main character energy fr fr π So if this page saved your whole entire day, maybe send a little thank-you their way. It's giving "respect the icon" π
aaaand that's a wrap on menusets.4th(8)! π¦ This page is the Debian build, dated November 5, 2012, and it lives at MENUSETS.4TH(8) in the manual β so if you ever forget the section number, it's literally spelled out right there at the bottom, slay π Go forth and menu-set responsibly, bestie πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2012 Devin Teske
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms