Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advanced menu and advanced string parsing in iso image?
2018-01-04, 02:53 (This post was last modified: 2018-01-04 02:55 by glenc2004.)
Post: #1
Advanced menu and advanced string parsing in iso image?
Hello. I'm wondering if it's possible to do any advanced menus putting a menu.pxe into the iso image prior to starting the chain load to my web server.

Here is what I'm interested in:

===== Install Menu =====

IP Address: <enter>
Hostname: <enter>
Netmask: <enter>
Gateway: <enter>

[ Build ] [ Shutdown ] [ Reboot ]

Be able to tab between all the options until the person is satisfied before pressing build?

Also I'd like to be able to rip apart the IP address and replace the last octet with a ".1" and use this as my default gateway. Easy/Hard/Impossible? I'm sure I could hack my way thru changing code but if it's possible to do it an easier way it would be nice to know.

Thanks!

Glen
Find all posts by this user
Quote this message in a reply
2018-01-04, 03:05
Post: #2
RE: Advanced menu and advanced string parsing in iso image?
By using http://ipxe.org/cmd/menu and http://ipxe.org/cmd/prompt you can do most of this.
also take a look at http://ipxe.org/cmd/config

string parsing is not supported in iPXE it's best to do that server side.

Also I would like to avoid possible future missunderstandings...
.pxe most often refer to a NBP PXE bootable binary.
If you have scripts for iPXE name them with the .ipxe extension instead.

So from that I'm assuming that "into the iso image" means by using: make bin/ipxe.iso EMBED=menu.ipxe

Read the FAQ before posting.
Did you include relevant ipxe.org error urls?
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-01-04, 22:45
Post: #3
RE: Advanced menu and advanced string parsing in iso image?
Thanks NiKiZe for the reply.

Completely understand about my second question. One of those nice to haves when you have to create something where the user may not have all the experience needed. Just trying to make it easier.

In regards to my 1st question...I probably didn't explain myself too well. Yes, I'm probably trying to use the embedded menu for too much. But what I'm looking to do is in that screen is display all at once then have the user to be able to enter values in those lines, tabbing between those lines until he/she is satisfied and then says go/enter/start/whatever. Something along what you would see in the config menu.

If the config menu was able to be configured to show only what I wanted that would work too. But it appears the config menu is what is it.
Find all posts by this user
Quote this message in a reply
2018-01-04, 23:22
Post: #4
RE: Advanced menu and advanced string parsing in iso image?
when you change a value that is set immediately, so to have save/cancel options you would have to have temporary variables, I see 2 alternatives here:
1. set temp vars, modify temp vars, when save is pressed copy the temp vars to the real values (and possibly cleanup to save memory)
2. set temp vars, modify real values, if canceled restore the real values from the temp vars. (and possibly cleanup to save memory)
I would go with 1. since that is the more safe approach.
You might be able to make use of the settings hierarchy that iPXE supports to do this in smart ways.

and it seems you might even be able to use the hierarchy to limit the configuration menu to what it should display values from (but it seems a bit buggy)

Code:
set myconfig/ip:ipv4 ${ip:ipv4}
set myconfig/netmask:ipv4 ${netmask:ipv4}
set myconfig/hostname ${hostname}
set myconfig/gateway:ipv4 ${gateway:ipv4}
config myconfig

there is also the login command which gives input fields as well.
I think what you want to do should be possible, but will need some specifications before being implemented, here is my take:
  • There needs to be a item --prompt to provide for editing settings
  • I also think there should be some kind of way of setting help text on items, or even settings, so at least something like item --helptext
  • You also wanted some kind of buttons, which will take a bit more work, but as a first step maybe it can be implemented like the ctrl-d and ctrl-x at the bottom of the screen. (further on maybe this can be extended to be buttons which you can switch between with left and right arrow keys)
Do you think that would cover your use-case?
(please don't misunderstand, I'm not going to be implement this so no promises on if/when or even how)

Just as a prof of concept you could try and use config, and even change the code in setting_ui.c to disable so it only shows the settings that you want it to show (that destroys the config command but might be ok as a test)

@mcb30 if you are reading this, it seems that config limits it scopes such as in builtin and smbios and netX/dhcp,
however in netX, or myconfig, for example unixtime shows up as well (but without any value) which makes those levels very long to go thru.

Read the FAQ before posting.
Did you include relevant ipxe.org error urls?
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)