menu.ipxe.j2 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #!ipxe
  2. {% if early_menu_enabled -%}
  3. {{ early_menu_contents }}
  4. {%- endif %}
  5. :start
  6. chain --autofree boot.cfg ||
  7. echo Attempting to retrieve latest upstream version number...
  8. chain --timeout 5000 https://boot.netboot.xyz/version.ipxe ||
  9. ntp {{ time_server }} ||
  10. iseq ${cls} serial && goto ignore_cls ||
  11. set cls:hex 1b:5b:4a # ANSI clear screen sequence - "^[[J"
  12. set cls ${cls:string}
  13. :ignore_cls
  14. {% if 'x' in boot_version %}
  15. :version_check
  16. set latest_version {{ boot_version }}
  17. echo ${cls}
  18. iseq ${version} ${latest_version} && goto version_up2date ||
  19. echo
  20. echo Updated version of {{ site_name }} is available:
  21. echo
  22. echo Running version.....${version}
  23. echo Updated version.....${latest_version}
  24. echo
  25. echo Please download the latest version from {{ site_name }}.
  26. echo
  27. echo Attempting to chain to latest version...
  28. chain --autofree http://${boot_domain}/ipxe/${ipxe_disk} ||
  29. :version_up2date
  30. {% endif %}
  31. isset ${arch} && goto skip_arch_detect ||
  32. cpuid --ext 29 && set arch x86_64 || set arch i386
  33. iseq ${buildarch} arm64 && set arch arm64 ||
  34. :skip_arch_detect
  35. isset ${menu} && goto ${menu} ||
  36. isset ${ip} || dhcp || echo DHCP failed
  37. :main_menu
  38. clear menu
  39. set space:hex 20:20
  40. set space ${space:string}
  41. iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
  42. menu ${site_name}
  43. item --gap Default:
  44. item local ${space} Boot from local hdd
  45. item --gap Distributions:
  46. iseq ${menu_linux} 1 && item linux ${space} Linux Network Installs ||
  47. iseq ${menu_linux_arm} 1 && item linux-arm ${space} Linux Network Installs ||
  48. iseq ${menu_live} 1 && item live ${space} Live CDs ||
  49. iseq ${menu_live_arm} 1 && item live-arm ${space} Live CDs ||
  50. iseq ${menu_bsd} 1 && item bsd ${space} BSD Installs ||
  51. iseq ${menu_unix} 1 && item unix ${space} Unix Network Installs ||
  52. iseq ${menu_freedos} 1 && item freedos ${space} FreeDOS ||
  53. iseq ${menu_windows} 1 && item windows ${space} Windows ||
  54. item --gap Tools:
  55. iseq ${menu_utils} 1 && item utils-${platform} ${space} Utilities ||
  56. iseq ${menu_utils_arm} 1 && item utils-arm ${space} Utilities ||
  57. iseq ${arch} x86_64 && set bits 64 || set bits 32
  58. iseq ${arch} arm64 && set bits 64 ||
  59. item changebits ${space} Architecture: ${arch} (${bits}bit)
  60. item shell ${space} iPXE shell
  61. item netinfo ${space} Network card info
  62. item lspci ${space} PCI Device List
  63. item about ${space} About netboot.xyz
  64. {% if sigs_menu | bool %}
  65. item --gap Signature Checks:
  66. {% if sigs_enabled | bool %}
  67. item sig_check ${space} {{ site_name }} [ enabled: ${sigs_enabled} ]
  68. {% endif %}
  69. {% endif %}
  70. {% if custom_github_menus | bool %}
  71. isset ${github_user} && item --gap Custom Github Menu: ||
  72. isset ${github_user} && item custom-github ${space} ${github_user}'s Custom Menu ||
  73. {% endif %}
  74. {% if custom_url_menus | bool %}
  75. isset ${custom_url} && item --gap Custom URL Menu: ||
  76. isset ${custom_url} && item custom-url ${space} Custom URL Menu ||
  77. {% endif %}
  78. {% if custom_generate_menus | bool %}
  79. item --gap Custom User Menus: ||
  80. item custom-user ${space} Custom User Menus
  81. {% endif %}
  82. isset ${menu} && set timeout 0 || set timeout ${boot_timeout}
  83. choose --timeout ${timeout} --default ${menu} menu || goto local
  84. echo ${cls}
  85. goto ${menu} ||
  86. iseq ${sigs_enabled} true && goto verify_sigs || goto change_menu
  87. :verify_sigs
  88. imgverify ${menu}.ipxe ${sigs}${menu}.ipxe.sig || goto error
  89. goto change_menu
  90. :change_menu
  91. chain ${menu}.ipxe || goto error
  92. goto main_menu
  93. :error
  94. echo Error occured, press any key to return to menu ...
  95. prompt
  96. goto main_menu
  97. :local
  98. echo Booting from local disks ...
  99. exit 0
  100. :shell
  101. echo Type "exit" to return to menu.
  102. set menu main_menu
  103. shell
  104. goto main_menu
  105. :changebits
  106. iseq ${arch} x86_64 && set arch i386 || set arch x86_64
  107. goto main_menu
  108. :sig_check
  109. iseq ${sigs_enabled} true && set sigs_enabled false || set sigs_enabled true
  110. goto main_menu
  111. :about
  112. chain https://boot.netboot.xyz/about.ipxe || chain about.ipxe
  113. goto main_menu
  114. :custom-github
  115. chain https://raw.githubusercontent.com/${github_user}/netboot.xyz-custom/master/custom.ipxe || goto error
  116. goto main_menu
  117. :custom-url
  118. chain ${custom_url}/custom.ipxe || goto error
  119. goto main_menu
  120. :custom-user
  121. chain custom/custom.ipxe
  122. goto main_menu