utils-pcbios.ipxe.j2 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!ipxe
  2. menu Utilities - Image Sig Checks: [${img_sigs_enabled}]
  3. item --gap Utilities:
  4. {% for key, value in utilitiespcbios.items() | sort(attribute='1.name') %}
  5. {% if value.enabled %}
  6. item {{ key }} ${space} {{ value.name }}
  7. {% endif %}
  8. {% endfor %}
  9. item --gap netboot.xyz tools:
  10. item nbxyz-custom ${space} Set Github username [user: ${github_user}]
  11. item testdistro ${space} Test Distribution ISO
  12. item testpr ${space} Test forked netboot.xyz branch or hash
  13. item nbxyz ${space} netboot.xyz endpoints
  14. choose --default ${menu} menu || goto utils_exit
  15. echo ${cls}
  16. goto ${menu} ||
  17. chain ${menu}.ipxe || goto utils_exit
  18. goto utils_exit
  19. {% for key, value in utilitiespcbios.items() | sort %}
  20. {% if value.enabled | bool and value.type == "memdisk" %}
  21. :{{ key }}
  22. set util_path {{ value.util_path }}
  23. set util_file {{ value.util_path | basename }}
  24. set util_version {{ value.version }}
  25. goto boot_{{ value.type }}
  26. {% endif %}
  27. {% endfor %}
  28. {% for key, value in utilitiespcbios.items() | sort %}
  29. {% if value.enabled | bool and value.type == "direct" %}
  30. :{{ key }}
  31. imgfree
  32. kernel {{ value.kernel }}
  33. initrd {{ value.initrd }}
  34. boot
  35. goto utils_exit
  36. {% endif %}
  37. {% endfor %}
  38. :boot_memdisk
  39. imgfree
  40. kernel ${memdisk} iso raw
  41. initrd --name ${util_file} ${util_path}
  42. echo
  43. echo MD5sums:
  44. md5sum memdisk ${util_file}
  45. iseq ${img_sigs_enabled} true && goto verify_sigs || goto skip_sigs
  46. :verify_sigs
  47. echo
  48. echo Checking signatures...
  49. imgverify memdisk ${sigs}memdisk.sig || goto error
  50. imgverify ${util_file} ${sigs}${menu}/${util_file}.sig || goto error
  51. echo Signatures verified!
  52. echo
  53. :skip_sigs
  54. boot
  55. goto utils_exit
  56. :memtest
  57. imgfree
  58. kernel {{ utilitiespcbios.memtest.util_path }}
  59. boot
  60. goto utils_exit
  61. :nbxyz-custom
  62. echo EXPERIMENTAL
  63. echo
  64. echo Make sure you have a fork of https://github.com/netbootxyz/netboot.xyz-custom.
  65. echo You can then customize your fork as needed and set up your own custom options.
  66. echo Once your username is set, a custom option will appear on the main menu.
  67. echo
  68. echo -n Please enter your Github username: ${} && read github_user
  69. goto utils_exit
  70. :testdistro
  71. echo This option will allow you to test booting an ISO using memdisk. Please
  72. echo specify the URL of the ISO you want to test and it will automatically
  73. echo attempt to load the ISO using memdisk.
  74. echo -n URL: ${} && read distro_iso
  75. kernel ${memdisk} iso raw
  76. initrd ${distro_iso}
  77. boot
  78. goto utils_exit
  79. :testpr
  80. clear github_user
  81. clear github_branch_or_hash
  82. echo This will chainload into a testing branch of netboot.xyz. You'll need to enter
  83. echo your Github username and the first part of the commit hash of the commit you want
  84. echo to test or the branch name. This assumes you are testing from a forked netboot.xyz
  85. echo repo.
  86. echo
  87. echo -n Specify Github username: ${} && read github_user
  88. echo -n Specify Github branch name or commit hash ( i.e. my_feature or 30b7ca ): ${} && read github_branch_or_hash
  89. echo
  90. echo Attempting to chainload branch or hash:
  91. chain --autofree https://raw.githubusercontent.com/${github_user}/netboot.xyz/${github_branch_or_hash}/src/menu.ipxe || echo Unable to find Github branch or hash... && sleep 5 && goto utils_exit
  92. goto utils_exit
  93. :utils_exit
  94. clear menu
  95. exit 0