iPXE discussion forum
Setting goto with whitespace? - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Setting goto with whitespace? (/showthread.php?tid=7767)



Setting goto with whitespace? - perestroika - 2015-07-13 02:11

Hello!

I'm trying to configure iPXE to do certain things when it detects a certain model device. For this purpose i'm using the ${product} variable.

For example, I'd implement something like:

Quote:goto ${product} || goto continue

:Lenovo T400S
do_something_here
goto continue

:continue
do_other_stuff_here

For this example if I PXEboot a T400, iPXE would read the ${product} variable and then goes to the label for the T400. If I PXEboot anything else it would just goto the continue label instead.

The problem is that I don't think that the label accepts whitespaces. I've tried implementing this instead:

Quote:set t400 Lenovo T400s
goto ${product} || goto continue

:${t400}
do_something_here
goto continue

:continue
do_other_stuff_here

Unfortunately that doesn't seem to work either.

Does anyone have any hints as to what I'm currently doing wrong here?


RE: Setting goto with whitespace? - NiKiZe - 2015-07-14 17:57

goto only takes one argument, since you have a space it becomes 2.

Maybe you can use goto ${product:uristring} instead. (and then use %20 in the label line)
And as an last restort you can use ${product:hexraw} instead.

But reading the sources, Only space should be an separator in the label so uristring hack should work.

https://git.ipxe.org/ipxe.git/blob/24112d91a0ab4c29794bc7750cbfc4166bc9026a:/src/image/script.c#l322