menu.ipxe.j2 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #!ipxe
  2. {% if early_menu_enabled -%}
  3. {{ early_menu_contents }}
  4. {%- endif %}
  5. :start
  6. isset ${arch} && goto skip_arch_detect ||
  7. cpuid --ext 29 && set arch x86_64 || set arch i386
  8. iseq ${buildarch} arm64 && set arch arm64 ||
  9. :skip_arch_detect
  10. chain --autofree boot.cfg ||
  11. echo Attempting to retrieve latest upstream version number...
  12. chain --timeout 5000 https://boot.netboot.xyz/version.ipxe ||
  13. ntp {{ time_server }} ||
  14. iseq ${cls} serial && goto ignore_cls ||
  15. set cls:hex 1b:5b:4a # ANSI clear screen sequence - "^[[J"
  16. set cls ${cls:string}
  17. :ignore_cls
  18. {% if 'x' in boot_version %}
  19. :version_check
  20. set latest_version {{ boot_version }}
  21. echo ${cls}
  22. iseq ${version} ${latest_version} && goto version_up2date ||
  23. echo
  24. echo Updated version of {{ site_name }} is available:
  25. echo
  26. echo Running version.....${version}
  27. echo Updated version.....${latest_version}
  28. echo
  29. echo Please download the latest version from {{ site_name }}.
  30. echo
  31. echo Attempting to chain to latest version...
  32. chain --autofree http://${boot_domain}/ipxe/${ipxe_disk} ||
  33. :version_up2date
  34. {% endif %}
  35. isset ${menu} && goto ${menu} ||
  36. isset ${ip} || dhcp
  37. :main_menu
  38. clear menu
  39. set space:hex 20:20
  40. set space ${space:string}
  41. isset ${next-server} && menu ${site_name} v${version} - next-server: ${next-server} || menu ${site_name}
  42. item --gap Default:
  43. item local ${space} Boot from local hdd
  44. item --gap Distributions:
  45. iseq ${menu_linux} 1 && item linux ${space} Linux Network Installs (64-bit) ||
  46. iseq ${menu_linux_i386} 1 && item linux-i386 ${space} Linux Network Installs (32-bit) ||
  47. iseq ${menu_linux_arm} 1 && item linux-arm ${space} Linux Network Installs (arm64) ||
  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 && iseq ${platform} efi && item utils-efi ${space} Utilities (UEFI) ||
  56. iseq ${menu_utils} 1 && iseq ${platform} pcbios && iseq ${arch} x86_64 && item utils-pcbios-64 ${space} Utilities (64-bit) ||
  57. iseq ${menu_utils} 1 && iseq ${platform} pcbios && iseq ${arch} i386 && item utils-pcbios-32 ${space} Utilities (32-bit) ||
  58. iseq ${menu_utils_arm} 1 && item utils-arm ${space} Utilities (arm64) ||
  59. item change_arch ${space} Architecture: ${arch}
  60. item shell ${space} iPXE shell
  61. item netinfo ${space} Network card info
  62. iseq ${menu_pci} 1 && 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 occurred, press any key to return to menu ...
  95. prompt
  96. goto main_menu
  97. :local
  98. echo Booting from local disks ...
  99. exit 1
  100. :shell
  101. echo Type "exit" to return to menu.
  102. set menu main_menu
  103. shell
  104. goto main_menu
  105. :change_arch
  106. iseq ${arch} x86_64 && set arch i386 && set menu_linux_i386 1 && set menu_linux 0 && goto main_menu ||
  107. iseq ${arch} i386 && set arch x86_64 && set menu_linux_i386 0 && set menu_linux 1 && goto main_menu ||
  108. goto main_menu
  109. :sig_check
  110. iseq ${sigs_enabled} true && set sigs_enabled false || set sigs_enabled true
  111. goto main_menu
  112. :about
  113. chain https://boot.netboot.xyz/about.ipxe || chain about.ipxe
  114. goto main_menu
  115. :custom-github
  116. chain https://raw.githubusercontent.com/${github_user}/netboot.xyz-custom/master/custom.ipxe || goto error
  117. goto main_menu
  118. :custom-url
  119. chain ${custom_url}/custom.ipxe || goto error
  120. goto main_menu
  121. :custom-user
  122. chain custom/custom.ipxe
  123. goto main_menu