1 \ Menu.rc
   2 \
   3 \ Load required Forth modules
   4 include /boot/forth/version.4th
   5 include /boot/forth/brand.4th
   6 include /boot/forth/menu.4th
   7 include /boot/forth/menu-commands.4th
   8 include /boot/forth/shortcuts.4th
   9 
  10 \ Screen prep
  11 clear         \ clear the screen (see `screen.4th')
  12 print_version \ print version string (bottom-right; see `version.4th')
  13 draw-beastie  \ draw freebsd mascot (on right; see `beastie.4th')
  14 draw-brand    \ draw the FreeBSD title (top-left; see `brand.4th')
  15 menu-init     \ initialize the menu area (see `menu.4th')
  16 
  17 \ Initialize main menu constructs (see `menu.4th')
  18 \ NOTE: To use `non-ansi' variants, add `loader_color=0' to loader.conf(5)
  19 \ NOTE: ANSI variants can use `^' in place of literal `Esc' (ASCII 27)
  20 
  21 \
  22 \ MAIN MENU
  23 \
  24 
  25 set menuset_name1="main"
  26 
  27 set mainmenu_init[1]="init_boot"
  28 
  29 s" smartos" getenv? [if]
  30         set mainmenu_caption[1]="Boot SmartOS [Enter]"
  31         set maintoggled_text[1]="R[e]covery (root/root) [Enter]"
  32         set mainansi_caption[1]="^[1mB^[moot SmartOS ^[1m[Enter]^[m"
  33         set maintoggled_ansi[1]="R^[1me^[mcovery (root/root) ^[1m[Enter]^[m"
  34 [else]
  35         set mainmenu_caption[1]="Boot Multi User [Enter]"
  36         set maintoggled_text[1]="Boot [S]ingle User [Enter]"
  37         set mainansi_caption[1]="^[1mB^[moot Multi User ^[1m[Enter]^[m"
  38         set maintoggled_ansi[1]="Boot ^[1mS^[mingle User ^[1m[Enter]^[m"
  39 [then]
  40 set mainmenu_command[1]="boot"
  41 \ keycode set by init_boot
  42 
  43 set mainmenu_init[2]="init_altboot"
  44 s" smartos" getenv? [if]
  45         set mainmenu_caption[2]="[R]ecovery (root/root)"
  46         set maintoggled_text[2]="[B]oot SmartOS"
  47         set mainansi_caption[2]="^[1mR^[mecovery (root/root)"
  48         set maintoggled_ansi[2]="^[1mB^[oot SmartOS"
  49 [else]
  50         set mainmenu_caption[2]="Boot [S]ingle User"
  51         set maintoggled_text[2]="Boot [M]ulti User"
  52         set mainansi_caption[2]="Boot ^[1mS^[mingle User"
  53         set maintoggled_ansi[2]="Boot ^[1mM^[multi User"
  54 [then]
  55 set mainmenu_command[2]="altboot"
  56 \ keycode set by init_altboot
  57 
  58 set mainmenu_caption[3]="[Esc]ape to loader prompt"
  59 set mainmenu_command[3]="goto_prompt"
  60 set mainmenu_keycode[3]=27
  61 set mainansi_caption[3]="^[1mEsc^[mape to loader prompt"
  62 
  63 \ Enable built-in "Reboot" trailing menuitem
  64 \ NOTE: appears before menu_options if configured
  65 \
  66 set mainmenu_reboot
  67 
  68 \ Enable "Options:" separator. When set to a numerical value (1-8), a visual
  69 \ separator is inserted before that menuitem number.
  70 \
  71 set mainmenu_options=5
  72 
  73 \ illumos does not have multiple kernels
  74 \ set mainmenu_kernel=5
  75 \ set mainmenu_command[5]="cycle_kernel"
  76 \ set mainmenu_keycode[5]=107
  77 
  78 set mainmenu_caption[5]="Configure Boot [O]ptions..."
  79 set mainmenu_command[5]="2 goto_menu"
  80 set mainmenu_keycode[5]=111
  81 set mainansi_caption[5]="Configure Boot ^[1mO^[mptions..."
  82 
  83 \ Boot Environments are (supported) only on ZFS
  84 s" currdev" getenv drop 4 s" zfs:" compare 0= be-pages and [if]
  85 set mainmenu_caption[6]="Select Boot [E]nvironment..."
  86 set mainmenu_command[6]="3 goto_menu"
  87 set mainmenu_keycode[6]=101
  88 set mainansi_caption[6]="Select Boot ^[1mE^[mnvironment..."
  89 
  90   s" chain_disk" getenv? [if]
  91         set mainmenu_caption[7]="Chain[L]oad ${chain_disk}"
  92         set mainmenu_command[7]="chain ${chain_disk}"
  93         set mainmenu_keycode[7]=108
  94         set mainansi_caption[7]="Chain^[1mL^[moad ${chain_disk}"
  95   [then]
  96 [else]
  97   s" chain_disk" getenv? [if]
  98         set mainmenu_caption[6]="Chain[L]oad ${chain_disk}"
  99         set mainmenu_command[6]="chain ${chain_disk}"
 100         set mainmenu_keycode[6]=108
 101         set mainansi_caption[6]="Chain^[1mL^[moad ${chain_disk}"
 102   [then]
 103 [then]
 104 
 105 \
 106 \ BOOT OPTIONS MENU
 107 \
 108 
 109 set menuset_name2="options"
 110 
 111 set optionsmenu_caption[1]="Back to Main Menu [Backspace]"
 112 set optionsmenu_command[1]="1 goto_menu"
 113 set optionsmenu_keycode[1]=8
 114 set optionsansi_caption[1]="Back to Main Menu ^[1m[Backspace]^[m"
 115 
 116 \ set optionsmenu_caption[2]="Load System [D]efaults"
 117 \ set optionsmenu_command[2]="set_default_boot_options"
 118 \ set optionsmenu_keycode[2]=100
 119 \ set optionsansi_caption[2]="Load System ^[1mD^[mefaults"
 120 
 121 set optionsmenu_options=2
 122 set optionsmenu_optionstext="Boot Options:"
 123 
 124 set optionsmenu_osconsole=2
 125 set optionsmenu_command[2]="cycle_osconsole"
 126 set optionsmenu_keycode[2]=99
 127 
 128 set optionsmenu_acpi=3
 129 set optionsmenu_command[3]="cycle_acpi"
 130 set optionsmenu_keycode[3]=97
 131 
 132 set optionsmenu_init[4]="init_singleuser"
 133 set optionsmenu_caption[4]="[S]ingle User. Off"
 134 set optionstoggled_text[4]="[S]ingle User. On"
 135 set optionsmenu_command[4]="toggle_singleuser"
 136 set optionsmenu_keycode[4]=115
 137 set optionsansi_caption[4]="^[1mS^[mingle User. ^[34;1mOff^[m"
 138 set optionstoggled_ansi[4]="^[1mS^[mingle User. ^[32;7mOn^[m"
 139 
 140 set optionsmenu_init[5]="init_verbose"
 141 set optionsmenu_caption[5]="[V]erbose..... Off"
 142 set optionstoggled_text[5]="[V]erbose..... On"
 143 set optionsmenu_command[5]="toggle_verbose"
 144 set optionsmenu_keycode[5]=118
 145 set optionsansi_caption[5]="^[1mV^[merbose..... ^[34;1mOff^[m"
 146 set optionstoggled_ansi[5]="^[1mV^[merbose..... ^[32;7mOn^[m"
 147 
 148 set optionsmenu_init[6]="init_reconfigure"
 149 set optionsmenu_caption[6]="[R]econfigure. Off"
 150 set optionstoggled_text[6]="[R]econfigure. On"
 151 set optionsmenu_command[6]="toggle_reconfigure"
 152 set optionsmenu_keycode[6]=114
 153 set optionsansi_caption[6]="^[1mR^[meconfigure. ^[34;1mOff^[m"
 154 set optionstoggled_ansi[6]="^[1mR^[meconfigure. ^[32;7mOn^[m"
 155 
 156 set optionsmenu_init[7]="init_kmdb"
 157 set optionsmenu_caption[7]="k[m]db........ Off"
 158 set optionstoggled_text[7]="k[m]db........ On"
 159 set optionsmenu_command[7]="toggle_kmdb"
 160 set optionsmenu_keycode[7]=109
 161 set optionsansi_caption[7]="k^[1mm^[mdb........ ^[34;1mOff^[m"
 162 set optionstoggled_ansi[7]="k^[1mm^[mdb........ ^[32;7mOn^[m"
 163 
 164 set optionsmenu_init[8]="init_debug"
 165 set optionsmenu_caption[8]="[D]ebug....... Off"
 166 set optionstoggled_text[8]="[D]ebug....... On"
 167 set optionsmenu_command[8]="toggle_debug"
 168 set optionsmenu_keycode[8]=100
 169 set optionsansi_caption[8]="^[1mD^[mebug....... ^[34;1mOff^[m"
 170 set optionstoggled_ansi[8]="^[1mD^[mebug....... ^[32;7mOn^[m"
 171 
 172 \
 173 \ BOOT ENVIRONMENT MENU
 174 \
 175 
 176 \ the BE list is read from [pool]/boot/menu.lst, the list in file
 177 \ is ordered from oldest to most recent.
 178 \ the BE menu will list entries from most recent to oldest,
 179 \ so the first page in menu is last page in menu.lst
 180 
 181 be-pages [if]
 182   set zfs_be_currpage=1
 183   be-set-page                   \ set page data
 184   set menuset_name3="bootenv"
 185 
 186   set bootenvmenu_command[1]="be_draw_screen 1 goto_menu"
 187   set bootenvmenu_keycode[1]=8
 188 
 189   set bootenvmenu_keycode[2]=8
 190   set bootenvmenu_command[2]="be_draw_screen 1 goto_menu"
 191 
 192   set bemenu_current="Active: "
 193   set beansi_current="^[1m${bemenu_current}^[m"
 194   set bemenu_bootfs="bootfs: "
 195   set beansi_bootfs="^[1m${bemenu_bootfs}^[m"
 196   set bemenu_page="[P]age: "
 197   set beansi_page="^[1mP^[mage: "
 198   set bemenu_pageof=" of "
 199   set beansi_pageof="${bemenu_pageof}"
 200 
 201   set bootenvmenu_init="init_bootenv"
 202 
 203   set bootenvmenu_keycode[3]=112
 204   set bootenvmenu_command[3]="set_be_page"
 205 
 206   set bootenvmenu_options=4
 207   set bootenvmenu_optionstext="Boot Environments:"
 208 [then]
 209 
 210 \ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to
 211 \ customize the timeout; default is 10-seconds)
 212 \
 213 set menu_timeout_command="boot"
 214 
 215 \ Include optional elements defined in a local file
 216 \
 217 try-include /boot/menu.rc.local
 218 
 219 \ Display the main menu (see `menu.4th')
 220 set menuset_initial=1
 221 menuset-loadinitial
 222 menu-display