1
0

netboot.xyz-gce.j2 2.3 KB

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