Skip to content

Commit

Permalink
Refs #36833 - New PXE loader "Grub2 UEFI SecureBoot (target OS)"
Browse files Browse the repository at this point in the history
  • Loading branch information
goarsna committed Nov 22, 2023
1 parent 93a91ed commit ec8af49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/tftp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,16 @@ def pxeconfig_file(mac)

class Pxegrub2targetos < Server
def setup_bootloader(mac, os)
bootloader_directory = Proxy::TFTP::Plugin.settings.bootloader_universe
raise "Bootloader directory not configured in TFTP seetings." if bootloader_directory.blank?
grub_binary_path = "#{bootloader_directory}/#{os}/grubx64.efi"
raise "File #{grub_binary_path} not found." unless File.exist?(grub_binary_path)
shim_binary_path = "#{bootloader_directory}/#{os}/shimx64.efi"
raise "File #{shim_binary_path} not found." unless File.exist?(shim_binary_path)
pxeconfig_dir_mac = pxeconfig_dir(mac)
FileUtils.mkdir_p(pxeconfig_dir_mac)
bootloader_directory = (Proxy::TFTP::Plugin.settings.bootloader_universe || "/usr/local/share/bootloader-universe")
FileUtils.cp("#{bootloader_directory}/#{os}/grubx64.efi", "#{pxeconfig_dir_mac}/grubx64.efi")
FileUtils.cp("#{bootloader_directory}/#{os}/shimx64.efi", "#{pxeconfig_dir_mac}/shimx64.efi")
FileUtils.cp("#{grub_binary_path}", "#{pxeconfig_dir_mac}/grubx64.efi")
FileUtils.cp("#{shim_binary_path}", "#{pxeconfig_dir_mac}/shimx64.efi")
File.write(File.join(pxeconfig_dir_mac, 'targetos'), os)
end

Expand Down

0 comments on commit ec8af49

Please sign in to comment.