diff options
author | Simon Rettberg | 2019-02-12 15:03:04 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-02-12 15:03:04 +0100 |
commit | 6581210de2a1644fcf665b93819b5cb08aa9b1b2 (patch) | |
tree | f09c1956c9cc9687ee626f75b7de4e692a63b76f /data | |
parent | [CreateLdapConfig] Fix detection of valid CN (diff) | |
download | tmlite-bwlp-6581210de2a1644fcf665b93819b5cb08aa9b1b2.tar.gz tmlite-bwlp-6581210de2a1644fcf665b93819b5cb08aa9b1b2.tar.xz tmlite-bwlp-6581210de2a1644fcf665b93819b5cb08aa9b1b2.zip |
[CompileIPxe*] Separate legacy pxelinux and new ipxe-only approach
Diffstat (limited to 'data')
-rw-r--r-- | data/ipxe-embed.template | 91 | ||||
-rw-r--r-- | data/pxelinux-ipxe-embed.template | 13 | ||||
-rw-r--r-- | data/pxelinux-pxemenu.template (renamed from data/pxemenu.template) | 0 |
3 files changed, 93 insertions, 11 deletions
diff --git a/data/ipxe-embed.template b/data/ipxe-embed.template index 8ef845f..3a8a1a7 100644 --- a/data/ipxe-embed.template +++ b/data/ipxe-embed.template @@ -1,13 +1,82 @@ #!ipxe -ifopen -set net0.dhcp/next-server %ipaddress% || -set net0.dhcp/filename ipxelinux.0 || -clear net0.dhcp/210:string || -#set net0.dhcp/209:string pxelinux.cfg/default || -set next-server %ipaddress% -set filename ipxelinux.0 -clear 210:string -#set 209:string pxelinux.cfg/default -imgload pxelinux.0 -boot pxelinux.0 + +console || goto cmd_fail + +# This should always be the case since this is the embed script, but making it dynamic is more flexible during testing +set slxtest:string something || goto cmd_fail +iseq \${slxtest:md5} \${} && set slxext 0 || set slxext 1 || + +set dosleep:int32 0 || +set idx:int32 -1 || + +# This will be set to usb or pxe +#goto %mode% + +:PXE + +set retlbl:string next_open +:next_open +inc idx +iseq 20 ${idx} && goto fail || +# No MAC -- done +iseq ${net${idx}/mac} ${} && goto fail || +# Has no IP -- ignore +iseq ${net${idx}/ip} ${} && goto cleaniface || +ifopen net${idx} || goto cleaniface +# Success +set retlbl dochain +goto setvars + +# Now try to chain to main script +:dochain +set self:string http://%ipaddress%/boot/ipxe?uuid=${uuid}&mac=${mac}&manuf=${manufacturer:uristring}&product=${product:uristring}&platform=${platform:uristring}&slx-extensions=${slxext} +chain -ar ${self} || goto fail +echo How the hell did I get here? +:fail +set retlbl retry_sleep +goto cleaniface +:retry_sleep +echo Trying again in ${dosleep} seconds... +sleep ${dosleep} || +iseq 0 ${dosleep} && set idx:int32 -1 || +set dosleep 5 || +:USB +iseq 20 ${idx} && set idx:int32 -1 || +set retlbl:string next_dhcp +:next_dhcp +inc idx +iseq 20 ${idx} && goto fail || +# No MAC -- done +iseq ${net${idx}/mac} ${} && goto next_dhcp || +echo Trying net${idx} via DHCP +dhcp net${idx} || goto cleaniface +# Success +set retlbl dochain +goto setvars + +# Clear interface IP address and close it +# Jumps back to label stored in ${retlbl} +:cleaniface +clear net${idx}/ip || +clear net${idx}.dhcp/ip || +ifclose net${idx} || +goto ${retlbl} + +# Force global variables to have the values of the interface we succeeded on +# Jumps back to label stored in ${retlbl} +:setvars +set ip ${net${idx}/ip} || +set mac ${net${idx}/mac} || +set netmask ${net${idx}/netmask} || +set gateway ${net${idx}/gateway} || +goto ${retlbl} + +:cmd_fail +echo This iPXE was compiled with important commands/features missing +echo Essential are: console, menu, param, set, clear +echo Optinally, reboot and poweroff would be nice +prompt Press any key to reboot || +reboot || echo OK, reboot is apparently missing, so.... +prompt Press any key to exit iPXE and return control to the BIOS || +exit 1 diff --git a/data/pxelinux-ipxe-embed.template b/data/pxelinux-ipxe-embed.template new file mode 100644 index 0000000..8ef845f --- /dev/null +++ b/data/pxelinux-ipxe-embed.template @@ -0,0 +1,13 @@ +#!ipxe +ifopen +set net0.dhcp/next-server %ipaddress% || +set net0.dhcp/filename ipxelinux.0 || +clear net0.dhcp/210:string || +#set net0.dhcp/209:string pxelinux.cfg/default || +set next-server %ipaddress% +set filename ipxelinux.0 +clear 210:string +#set 209:string pxelinux.cfg/default +imgload pxelinux.0 +boot pxelinux.0 + diff --git a/data/pxemenu.template b/data/pxelinux-pxemenu.template index 5d39364..5d39364 100644 --- a/data/pxemenu.template +++ b/data/pxelinux-pxemenu.template |