netboot.xyz-packet 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 version 1.04
  12. set ipxe_cloud_config packet
  13. :start
  14. echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_red}packet.com${fg_whi}${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 retry Retry boot
  25. item debug iPXE Debug Shell
  26. item reboot Reboot System
  27. choose failsafe_choice || exit
  28. goto ${failsafe_choice}
  29. :netconfig
  30. echo Network Configuration:
  31. echo Available interfaces...
  32. ifstat
  33. imgfree
  34. echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
  35. isset ${net} || set net 0
  36. echo -n IP: && read net${net}/ip
  37. echo -n Subnet mask: && read net${net}/netmask
  38. echo -n Gateway: && read net${net}/gateway
  39. echo -n DNS: && read dns
  40. ifopen net${net}
  41. echo Attempting chainload of netboot.xyz...
  42. goto menu || goto failsafe
  43. :menu
  44. set conn_type https
  45. chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
  46. sleep 5
  47. set conn_type http
  48. chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
  49. goto localboot
  50. :localboot
  51. exit
  52. :retry
  53. goto start
  54. :reboot
  55. reboot
  56. goto start
  57. :debug
  58. echo Type "exit" to return to menu
  59. shell
  60. goto failsafe