netboot.xyz-gce 1.6 KB

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