#!ipxe # DCL-OS boot loader: bring one network port up, then load the live menu. # Built by deploy/netboot/build-boot-media.sh, which fills in the menu URL. set dcl-menu http://mirror.datacorelink.com/boot.ipxe # ui=2: this loader draws the branded menu; mem: this machine's RAM in MB; v: this # boot media build, so the menu can tell an old ISO that a newer one exists. set dcl-query ?ui=2&v=202611022327&mem=${memsize} # The menu background is embedded next to this script. It is freed once drawn: a # registered image would be handed to the kernel as an initrd. Colours as in the # server menu; without a 1024x768 mode everything stays in text. console --x 1024 --y 768 --left 328 --right 32 --top 40 --bottom 40 --picture menu.png || imgfree menu.png || colour --rgb 0x101113 0 || colour --rgb 0xf79522 1 || colour --rgb 0x5c626b 2 || colour --rgb 0x262a30 4 || colour --rgb 0xd9dce1 7 || cpair --foreground 7 --background 9 1 || cpair --foreground 1 --background 4 2 || cpair --foreground 2 --background 9 3 || colour --rgb 0xe5484d 3 || cpair --foreground 7 --background 4 4 || cpair --foreground 3 --background 9 5 || echo echo DCL-OS network boot echo Menu: ${dcl-menu} echo :start menu DCL-OS network boot item --gap -- HOW SHOULD THIS MACHINE GET ITS ADDRESS? item --gap -- item --key 1 dhcp 1AutomaticDHCP from the network item --key 2 manual 2Manual IPtype IP, netmask, gateway and DNS item --key 3 internal 3DCL-OS Internal10.0.0.x in our data centres choose --timeout 60000 --default dhcp mode || goto dhcp goto ${mode} :dhcp clear dcl-static # Addresses typed earlier override DHCP answers, so drop them first. ifclose || clear net0/ip || clear net0/netmask || clear net0/gateway || clear net1/ip || clear net1/netmask || clear net1/gateway || clear net2/ip || clear net2/netmask || clear net2/gateway || clear net3/ip || clear net3/netmask || clear net3/gateway || clear net4/ip || clear net4/netmask || clear net4/gateway || clear net5/ip || clear net5/netmask || clear net5/gateway || clear net6/ip || clear net6/netmask || clear net6/gateway || clear net7/ip || clear net7/netmask || clear net7/gateway || clear dns || echo Asking for an address by DHCP on every port... dhcp && goto online || echo No DHCP answer. :manual clear dcl-link set port net0 isset ${net1/mac} || goto manual_form echo Looking for a port with a link... ifopen net0 && iflinkwait --timeout 1500 net0 && set dcl-link net0 && goto manual_ports || ifclose net0 || ifopen net1 && iflinkwait --timeout 1500 net1 && set dcl-link net1 && goto manual_ports || ifclose net1 || ifopen net2 && iflinkwait --timeout 1500 net2 && set dcl-link net2 && goto manual_ports || ifclose net2 || ifopen net3 && iflinkwait --timeout 1500 net3 && set dcl-link net3 && goto manual_ports || ifclose net3 || ifopen net4 && iflinkwait --timeout 1500 net4 && set dcl-link net4 && goto manual_ports || ifclose net4 || ifopen net5 && iflinkwait --timeout 1500 net5 && set dcl-link net5 && goto manual_ports || ifclose net5 || ifopen net6 && iflinkwait --timeout 1500 net6 && set dcl-link net6 && goto manual_ports || ifclose net6 || ifopen net7 && iflinkwait --timeout 1500 net7 && set dcl-link net7 && goto manual_ports || ifclose net7 || # More than one port: pick it by MAC address, the one with a cable preselected. :manual_ports isset ${dcl-link} && set port ${dcl-link} || menu Manual IP item --gap -- WHICH PORT IS CONNECTED? item --gap -- isset ${net0/mac} && item net0 net0${net0/mac}${net0/chip} || isset ${net1/mac} && item net1 net1${net1/mac}${net1/chip} || isset ${net2/mac} && item net2 net2${net2/mac}${net2/chip} || isset ${net3/mac} && item net3 net3${net3/mac}${net3/chip} || isset ${net4/mac} && item net4 net4${net4/mac}${net4/chip} || isset ${net5/mac} && item net5 net5${net5/mac}${net5/chip} || isset ${net6/mac} && item net6 net6${net6/mac}${net6/chip} || isset ${net7/mac} && item net7 net7${net7/mac}${net7/chip} || item --gap -- isset ${dcl-link} && item --gap -- Cable detected on ${dcl-link}. || item --gap -- No cable detected: pick the port by its MAC address. item --gap -- item back < Back to the network choice choose --default ${port} port || goto start iseq ${port} back && goto start || # One form for the address; typed ipv4 fields refuse anything that is not an address. :manual_form isset ${dcl-mask} || set dcl-mask:ipv4 255.255.255.0 isset ${dcl-dns} || set dcl-dns:ipv4 1.1.1.1 form Manual IP on ${port} (${${port}/mac}) item --gap -- Leave the IP address empty to use DHCP on this port. item dcl-ip:ipv4 IP address item dcl-mask:ipv4 Netmask item dcl-gw:ipv4 Gateway item dcl-dns:ipv4 DNS server present || goto start isset ${dcl-ip} || goto port_dhcp ifclose set ${port}/ip ${dcl-ip:ipv4} set ${port}/netmask ${dcl-mask:ipv4} isset ${dcl-gw} && set ${port}/gateway ${dcl-gw:ipv4} || set dns ${dcl-dns:ipv4} ifopen ${port} || goto port_failed set dcl-static 1 goto online :port_dhcp ifclose || clear ${port}/ip || clear ${port}/netmask || clear ${port}/gateway || clear dns || echo Asking for an address by DHCP on ${port}... dhcp ${port} && goto online || goto port_failed :port_failed set dcl-error Could not bring ${port} up. goto failed # DCL-OS data centres: 10.0.0.0/27 behind 10.0.0.1, no DHCP. Only the host number # is typed; the port is the first one whose link comes up. :internal echo echo DCL-OS Internal: 10.0.0.0/27, gateway 10.0.0.1, DNS 1.1.1.1 echo Press Enter for 10.0.0.2, or type the last number (2 to 30). clear host echo -n IP address: 10.0.0. && read host || clear host isset ${host} || set host 2 iseq ${host} 2 && goto internal_port || iseq ${host} 3 && goto internal_port || iseq ${host} 4 && goto internal_port || iseq ${host} 5 && goto internal_port || iseq ${host} 6 && goto internal_port || iseq ${host} 7 && goto internal_port || iseq ${host} 8 && goto internal_port || iseq ${host} 9 && goto internal_port || iseq ${host} 10 && goto internal_port || iseq ${host} 11 && goto internal_port || iseq ${host} 12 && goto internal_port || iseq ${host} 13 && goto internal_port || iseq ${host} 14 && goto internal_port || iseq ${host} 15 && goto internal_port || iseq ${host} 16 && goto internal_port || iseq ${host} 17 && goto internal_port || iseq ${host} 18 && goto internal_port || iseq ${host} 19 && goto internal_port || iseq ${host} 20 && goto internal_port || iseq ${host} 21 && goto internal_port || iseq ${host} 22 && goto internal_port || iseq ${host} 23 && goto internal_port || iseq ${host} 24 && goto internal_port || iseq ${host} 25 && goto internal_port || iseq ${host} 26 && goto internal_port || iseq ${host} 27 && goto internal_port || iseq ${host} 28 && goto internal_port || iseq ${host} 29 && goto internal_port || iseq ${host} 30 && goto internal_port || echo 10.0.0.${host} is not an address in 10.0.0.0/27. goto internal :internal_port echo Looking for a port with a link... ifopen net0 && iflinkwait --timeout 3000 net0 && set port net0 && goto internal_up || ifclose net0 || ifopen net1 && iflinkwait --timeout 3000 net1 && set port net1 && goto internal_up || ifclose net1 || ifopen net2 && iflinkwait --timeout 3000 net2 && set port net2 && goto internal_up || ifclose net2 || ifopen net3 && iflinkwait --timeout 3000 net3 && set port net3 && goto internal_up || ifclose net3 || ifopen net4 && iflinkwait --timeout 3000 net4 && set port net4 && goto internal_up || ifclose net4 || ifopen net5 && iflinkwait --timeout 3000 net5 && set port net5 && goto internal_up || ifclose net5 || ifopen net6 && iflinkwait --timeout 3000 net6 && set port net6 && goto internal_up || ifclose net6 || ifopen net7 && iflinkwait --timeout 3000 net7 && set port net7 && goto internal_up || ifclose net7 || set port net0 :internal_up ifclose set ${port}/ip 10.0.0.${host} set ${port}/netmask 255.255.255.224 set ${port}/gateway 10.0.0.1 set dns 1.1.1.1 ifopen ${port} || goto port_failed set dcl-static 1 goto online :online echo Address ${netX/ip} on ${netX/mac} echo Loading the DCL-OS menu... chain --replace --autofree ${dcl-menu}${dcl-query} || set dcl-error Could not load the DCL-OS menu. :failed menu Network boot did not start isset ${dcl-error} && item --gap -- ${dcl-error} || item --gap -- Address ${netX/ip} on ${netX/mac} item --gap -- Menu ${dcl-menu} item --gap -- item retry Try again item start Change network settings item shell iPXE shell item next Boot the next device choose --default retry action || goto start clear dcl-error iseq ${action} retry && goto online || iseq ${action} next && exit || iseq ${action} shell && shell || iseq ${action} shell && goto failed || goto start