[ipxe-devel] iPXE scripting enhancements

Michael Brown mbrown at fensystems.co.uk
Thu Dec 9 00:30:53 UTC 2010


On Wednesday 08 Dec 2010 22:01:16 Duane Voth wrote:
> On Sun, Nov 21, 2010 at 8:04 PM, Michael Brown <mcb30 at ipxe.org> wrote:
> > iPXE commands can now contain short-circuit logical operators such as
> > "&&" and
> > "||".  For example,
> >
> >  dhcp net0 || set net0/ip 192.168.0.2   # Use static IP if DHCP fails
> >
> > <snip>
>
> Excellent, quite useful!  These will also work for imgfetch etc. no?

Yes; they will work for all commands.  As an illustration of what can be done, 
here's the embedded script I've been using for testing for the past few days:

  #!ipxe

  echo Creating VLAN 2
  vcreate --tag 2 net0
  set NETDEV net0-2

  echo Acquiring IP address and boot filename on ${NETDEV}
  :dhcp
  dhcp ${NETDEV} && isset ${filename} || goto dhcp

  echo Downloading Tivoli reference image
  set TIVOLIBIN http://dolphin.home/images/tivoli.bin
  :imgfetch
  imgfree
  imgfetch ${TIVOLIBIN} || goto imgfetch
  imgstat

  echo Booting Tivoli (${filename})
  :boot
  chain ${filename} || goto boot

Michael



More information about the ipxe-devel mailing list