1
0

netboot.xyz-metal.j2 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!ipxe
  2. set esc:hex 1b
  3. set bold ${esc:string}[1m
  4. set boldoff ${esc:string}[22m
  5. set fg_gre ${esc:string}[32m
  6. set fg_red ${esc:string}[31m
  7. set fg_cya ${esc:string}[36m
  8. set fg_whi ${esc:string}[37m
  9. set HTTPS_ERR HTTPS appears to have failed... attempting HTTP
  10. set HTTP_ERR HTTP has failed, localbooting...
  11. set ipxe_version ${version}
  12. set version {{ boot_version }}
  13. set ipxe_cloud_config metal
  14. :start
  15. echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_red}metal.equinix.com${fg_whi}${boldoff}
  16. prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu... && goto failsafe || goto dhcp
  17. :dhcp
  18. echo
  19. dhcp || goto netconfig
  20. goto menu
  21. :failsafe
  22. menu netboot.xyz Failsafe Menu
  23. item localboot Boot to local drive
  24. item netconfig Manual network configuration
  25. item vlan Manual VLAN configuration
  26. item retry Retry boot
  27. item debug iPXE Debug Shell
  28. item reboot Reboot System
  29. choose failsafe_choice || exit
  30. goto ${failsafe_choice}
  31. :netconfig
  32. echo Network Configuration:
  33. echo Available interfaces...
  34. ifstat
  35. imgfree
  36. echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
  37. isset ${net} || set net 0
  38. echo -n IP: && read net${net}/ip
  39. echo -n Subnet mask: && read net${net}/netmask
  40. echo -n Gateway: && read net${net}/gateway
  41. echo -n DNS: && read dns
  42. ifopen net${net}
  43. echo Attempting chainload of netboot.xyz...
  44. goto menu || goto failsafe
  45. :vlan
  46. echo VLAN Configuration:
  47. echo Available interfaces...
  48. ifstat
  49. imgfree
  50. echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
  51. isset ${net} || set net 0
  52. echo -n Set VLAN 802.1Q tag [0 to 4094]: ${} && read vlan
  53. vcreate --tag ${vlan} net${net}
  54. ifconf --configurator dhcp net${net}-${vlan} || echo DHCP failed trying manual && goto netvlan
  55. echo Attempting chainload of ${boot_domain}...
  56. goto menu || goto failsafe
  57. :netvlan
  58. echo -n IP: && read net${net}-${vlan}/ip
  59. echo -n Subnet mask: && read net${net}-${vlan}/netmask
  60. echo -n Gateway: && read net${net}-${vlan}/gateway
  61. echo -n DNS: && read dns
  62. ifopen net${net}-${vlan}
  63. echo Attempting chainload of ${boot_domain}...
  64. goto menu || goto failsafe
  65. :menu
  66. set conn_type https
  67. chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
  68. sleep 5
  69. set conn_type http
  70. chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
  71. goto localboot
  72. :localboot
  73. exit
  74. :retry
  75. goto start
  76. :reboot
  77. reboot
  78. goto start
  79. :debug
  80. echo Type "exit" to return to menu
  81. shell
  82. goto failsafe