1
0

netboot.xyz-packet.j2 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 packet
  14. :start
  15. echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_red}packet.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 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. :menu
  45. set conn_type https
  46. chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
  47. sleep 5
  48. set conn_type http
  49. chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
  50. goto localboot
  51. :localboot
  52. exit
  53. :retry
  54. goto start
  55. :reboot
  56. reboot
  57. goto start
  58. :debug
  59. echo Type "exit" to return to menu
  60. shell
  61. goto failsafe