netboot.xyz 1.5 KB

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