iPXE discussion forum

Full Version: iPXE menu checkbox feature possible?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all. I wanted to ask everyone using ipxe if it's even possible to create checkbox type input for the user. So say you had several options for a server build you didn't necessarily want to create separate config files for. But just select able options during the install process and pass those menu options to the backend scripts.

I read someone you can do this with compiled menus but I can't seem to find that site again. If this is possible, can it be done dynamically?

Oh yes. If anyone has any samples or URL's that would be great too!

Thanks so much!

Glen
It should be quite possible. You can make a dynamic menu where each menu item is a toogle variable, and you select the variable item to toggle it and finally use the "continue" menu item to start the process. Possibly something like this (untested):

Code:
#!ipxe
# Assign defaults
set var1 1
set var2 0
:render_menu
menu
iseq ${var1} 1 && item disable_var1 [x] Disable variable 1 ||
iseq ${var1} 0 && item  enable_var1 [ ] Enable variable 1 ||
iseq ${var2} 1 && item disable_var2 [x] Disable variable 2 ||
ideq ${var2} 0 && item  enable_var2 [ ] Enable variable 2 ||
item
item abort Abort process
item start Start process
choose selected && goto ${selected} || goto abort

:abort
exit

:enable_var1
set var1 1
goto render_menu

:disable_var1
set var1 0
goto render_menu

:enable_var2
set var2 1
goto render_menu

:disable_var2
set var2 0
goto render_menu

:start
echo Variable 1: ${var1}
echo Variable 2: ${var2}
chain http://myserver/myscript.php?var1=${var1}&var2=${var2}
Reference URL's