Set Ipxe Menu selected Item conditionally
I know how to select a IPXE item menu by default through the web console.
I would like to know if we can select an item by default when the host is not registered and another if the host is ?
I can’t see a way to do it in http://@fogserverIP/fog/service/ipxe/boot.php.
Thanks for your time.
@tatanas I have not tested this so I’m only giving an idea.
You can setup a fog ipxe menu as a default menu.
You can setup a fog ipxe menu to only be displayed when a host is unregistered or a host is registered.
These are two different actions so I would think you could combine them to get the desired results.
There is an easy way to test and confirm. Create the two ipxe menus as I mentioned. Then get a mac address of a computer that is already registered.
from a windows browser call up this url for an unregistered host.
Search the page for the word default.
Now call up the same url with a registered host mac address
Again search for the word default. This should give you the menu for the registered host. Again I have not tested this but this is how it should work.
@george1421 Ok. I think I understand how it works. Let me try to resume :
When you call this url http://<fog_server_ip>/fog/service/ipxe/boot.php?mac=xx:xx:xx:xx:xx:xx, the boot.php file (located in /var/www/fog/service/ipxe/boot.php) will get the host informations through the mac address then create a personalized boot menu
This function can be found in /var/www/fog/lib/fog/bootmenu.class.php.
So it seems I should try to modified this file to change the default selected item depending on the host is registered or not ?
In the web console>iPXE Menu Customization, when I change the fog.local item menu from “All Hosts” to “Registered Hosts” and sets it to default, it become the default setup for the “Not registered Host” menu fog.reginput too.
Forget about it. It seems there is no easy way to do it and it’s not a big deal even if this kind of boot menu isn’t set up.
Thanks for your guidance.