Few scripting questions - Printable Version +- iPXE discussion forum (https://forum.ipxe.org) +-- Forum: iPXE user forums (/forumdisplay.php?fid=1) +--- Forum: General (/forumdisplay.php?fid=2) +--- Thread: Few scripting questions (/showthread.php?tid=7851) |
Few scripting questions - SoulA - 2015-10-22 23:22 I'm trying to enumerate interfaces from within iPXE. I figured I could loop through each one doing "dhcp net${i}", then looking for info on the NIC like "${netX/dhcp-server}" and finally closing the interface with "ifclose net${i}". I would like to skip over the interface that iPXE used when initially booting. The problem is I'm not seeing a way to get the name or even index of the current interface. Something like "${netX/ip}" except "${netX/index}" which returns "net0" for example. Anything like this available that I'm just not seeing? Second problem is there is the possibility that in our setup iPXE might be waiting around on a menu screen and intermittently checking an HTTP server for any boot instructions. Since iPXE doesn't have anything built into renew it's DHCP address before it's lease expires I figured I could do "dhcp net0" (also needs the index above) which seems to renew it just fine. The problem with this is after doing that it seems to break being able to do relative paths in scripts. The reason we need to renew is I don't want the DHCP server to hand out another lease with the same IP. Some psuedo code of what a script might look like for the interface enumeration http://pastebin.com/TRnAMkR5. RE: Few scripting questions - robinsmidsrod - 2016-03-17 12:53 With newer versions of iPXE you can get ${netX/ifname} which should return net0 or net1, depending on which interface you use. Then you can use the inc command to iterate through interfaces and skip the one that matches the open one. |