iPXE discussion forum
[solved] My first menu. "menu: command not found" - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: [solved] My first menu. "menu: command not found" (/showthread.php?tid=6065)



[solved] My first menu. "menu: command not found" - stefanlasiewski - 2012-10-11 18:40

I am attempting to write my first iPXE menu using https://gist.github.com/2234639 as an example.

However, when I write a basic menu, I get the error "menu: command not found".

Since this is my first attempt, I'm not sure if this is a syntax error, missing feature, a failure to load a library, etc. What am I missing?

Code:
#!ipxe
# menu.ipxe by stefanl
# hints from:
# http://jpmens.net/2011/07/18/network-booting-machines-over-http/
# https://gist.github.com/2234639
# http://ipxe.org/cmd/menu

# menu [--name <name>] [--delete] [<title>]
# item [--menu <menu>] [--key <key>] [--default] [<label>|--gap [<text>]]
# choose [--menu <menu>] [--default <label>] [--timeout <timeout>] [--keep] <setting>

# Setup some basic convenience variables
set menu-timeout 5000

# Ensure we have menu-default set to something
isset ${menu-default} || set menu-default exit

###################### MAIN MENU ####################################

:start
menu iPXE boot menu for NERSC Server Team
item --gap -- ------------------------- Operating systems ------------------------------
item
item
item --gap --           ------------------------- Advanced options -------------------------------
item --key c config     (c)onfigure settings
item --key s shell      Drop to iPXE (s)hell
item --key r reboot     (r)eboot computer
item
item --key x exit       E(x)it iPXE and continue BIOS boot
choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
set menu-timeout 0
goto ${selected}

:cancel
echo You cancelled the menu, dropping you to a shell

:shell
echo Type exit to get the back to the menu
shell
set menu-timeout 0
goto start

:failed
echo Booting failed, dropping to shell
goto shell

:reboot
reboot

:exit
exit

:config
config
goto start

Ah! I had an old version of undionly.kpxe . I am not sure what version I had, since I am not sure how to print the version string.

I updated to the latest version of iPXE from git://git.ipxe.org/ipxe.git , built from source, and the new version works.


RE: My first menu. "menu: command not found" - robinsmidsrod - 2012-10-11 20:54

The menu command was introduced in commit https://git.ipxe.org/ipxe.git/commit/f5c644cbe156573d23824a5c7046d1dec93eaf58 which is dated 2012-03-30, and slightly improved 2012-04-28 to support the --default parameter on choose. You also need to ensure #define MENU_CMD is on in src/config/general.h (which is the default).