1
0

netboot.xyz-gce.j2 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 version 1.04
  11. set ipxe_cloud_config gce
  12. :start
  13. echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_cya}Google Compute Engine${boldoff}
  14. prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu... && goto failsafe || goto dhcp
  15. :dhcp
  16. echo
  17. dhcp || goto netconfig
  18. goto menu
  19. :failsafe
  20. menu netboot.xyz Failsafe Menu
  21. item localboot Boot to local drive
  22. item netconfig Manual network configuration
  23. item retry Retry boot
  24. item debug iPXE Debug Shell
  25. item reboot Reboot System
  26. choose failsafe_choice || exit
  27. goto ${failsafe_choice}
  28. :netconfig
  29. echo Network Configuration:
  30. echo Available interfaces...
  31. ifstat
  32. imgfree
  33. echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
  34. isset ${net} || set net 0
  35. echo -n IP: && read net${net}/ip
  36. echo -n Subnet mask: && read net${net}/netmask
  37. echo -n Gateway: && read net${net}/gateway
  38. echo -n DNS: && read dns
  39. ifopen net${net}
  40. echo Attempting chainload of netboot.xyz...
  41. goto menu || goto failsafe
  42. :menu
  43. set conn_type https
  44. chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
  45. sleep 5
  46. set conn_type http
  47. chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
  48. goto localboot
  49. :localboot
  50. exit
  51. :retry
  52. goto start
  53. :reboot
  54. reboot
  55. goto start
  56. :debug
  57. echo Type "exit" to return to menu
  58. shell
  59. goto failsafe