Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to detect available download protocols or build options inside an iPXE script?
2016-02-05, 01:08
Post: #1
How to detect available download protocols or build options inside an iPXE script?
Is it possible, within an iPXE script, to base a conditional statement (or variable value) on whether or not a download protocol is available in the iPXE instance that is running?

IE: Use HTTP if available, if not, use a TFTP url for network booting, something like:

dhcp
isset ${19:integer} || goto noHttp
set url http://...
goto gotProto
:noHttp
set url tftp://....
:gotProto
echo Booting using ${url}
boot ${url}

Since DHCP option 19 is the feature indicator option for ipxe.http, but this doesn't seem to work, perhaps because the option is only set when iPXE is sending the DHCP request, but in this example it's testing the server response (?)

I know I could first try the HTTP and then fall back on the TFTP statement if it fails, but the output of this is messy.

Rob
Find all posts by this user
Quote this message in a reply
2016-02-06, 12:48
Post: #2
RE: How to detect available download protocols or build options inside an iPXE script?
(2016-02-05 01:08)robzr Wrote:  Is it possible, within an iPXE script, to base a conditional statement (or variable value) on whether or not a download protocol is available in the iPXE instance that is running?
...
I know I could first try the HTTP and then fall back on the TFTP statement if it fails, but the output of this is messy.

Sorry; there's no way to do this in the scripting language. The DHCP server can test on the basis of the feature flags exposed via option 175 in the DHCPDISCOVER/DHCPREQUEST, but those same flags aren't visible to a script. As you guessed, testing options via e.g. ${175.19} won't work because it will be looking for that option in the server response rather than in the client request.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
2016-02-06, 23:37
Post: #3
RE: How to detect available download protocols or build options inside an iPXE script?
Thanks Michael. I ended up doing exactly that, reading the option with dhcpd, setting the url and passing it in option 130. Works great! Nice work on iPXE, I had a GRUB based PXE selector for a few kickstart and rescue images, I migrated it over to iPXE, and find it more flexible and intuitive, and it's been more reliable for me as well. Great stuff!

Rob
Find all posts by this user
Quote this message in a reply
Post Reply 




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