Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit d47eee5

Browse files
committed
remove unnecessary checks
1 parent d627554 commit d47eee5

File tree

1 file changed

+53
-64
lines changed

1 file changed

+53
-64
lines changed

boot/grub/open.lua

Lines changed: 53 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function open (file, file_type, device, device_type, arch, platform)
321321
isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
322322
end
323323
if platform == "pc" then
324-
if device_type == "1" and grub.file_exist ("(loop)/sources/install.wim") and grub.file_exist ("/wimboot") and grub.file_exist ("/install.gz") then
324+
if device_type == "1" and grub.file_exist ("(loop)/sources/install.wim") and grub.file_exist ("/install.gz") then
325325
-- windows install iso
326326
icon = "nt6"
327327
towinpath (file)
@@ -411,47 +411,39 @@ function open (file, file_type, device, device_type, arch, platform)
411411
grub.add_icon_menu (icon, command, name)
412412
elseif platform == "pc" then
413413
-- wimboot
414-
if grub.file_exist ("/wimboot") then
415-
icon = "wim"
416-
command = "set lang=en_US; terminal_output console; enable_progress_indicator=1; loopback wimboot /wimboot; linux16 (wimboot)/wimboot; initrd16 newc:bootmgr:(wimboot)/bootmgr newc:bootmgr.exe:(wimboot)/bootmgr.exe newc:bcd:(wimboot)/bcd newc:boot.sdi:(wimboot)/boot.sdi newc:boot.wim:" .. file
417-
name = grub.gettext("Boot NT6.x WIM (wimboot)")
418-
grub.add_icon_menu (icon, command, name)
419-
end
414+
icon = "wim"
415+
command = "set lang=en_US; terminal_output console; enable_progress_indicator=1; loopback wimboot /wimboot; linux16 (wimboot)/wimboot; initrd16 newc:bootmgr:(wimboot)/bootmgr newc:bootmgr.exe:(wimboot)/bootmgr.exe newc:bcd:(wimboot)/bcd newc:boot.sdi:(wimboot)/boot.sdi newc:boot.wim:" .. file
416+
name = grub.gettext("Boot NT6.x WIM (wimboot)")
417+
grub.add_icon_menu (icon, command, name)
420418
-- BOOTMGR/NTLDR only supports (hdx,y)
421419
if device_type == "1" then
422-
if grub.file_exist ("/NTBOOT.MOD/NTBOOT.NT6") then
423-
-- NTBOOT NT6 WIM
424-
icon = "nt6"
425-
tog4dpath (file, device, device_type)
426-
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT NT6=" .. g4d_file .. "\";" ..
427-
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
428-
name = grub.gettext("Boot NT6.x WIM (NTBOOT)")
429-
grub.add_icon_menu (icon, command, name)
430-
end
431-
if grub.file_exist ("/NTBOOT.MOD/NTBOOT.PE1") then
432-
-- NTBOOT NT5 WIM (PE1)
433-
icon = "nt5"
434-
tog4dpath (file, device, device_type)
435-
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT pe1=" .. g4d_file .. "\";" ..
436-
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
437-
name = grub.gettext("Boot NT5.x WIM (NTBOOT)")
438-
grub.add_icon_menu (icon, command, name)
439-
end
420+
-- NTBOOT NT6 WIM
421+
icon = "nt6"
422+
tog4dpath (file, device, device_type)
423+
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT NT6=" .. g4d_file .. "\";" ..
424+
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
425+
name = grub.gettext("Boot NT6.x WIM (NTBOOT)")
426+
grub.add_icon_menu (icon, command, name)
427+
-- NTBOOT NT5 WIM (PE1)
428+
icon = "nt5"
429+
tog4dpath (file, device, device_type)
430+
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT pe1=" .. g4d_file .. "\";" ..
431+
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
432+
name = grub.gettext("Boot NT5.x WIM (NTBOOT)")
433+
grub.add_icon_menu (icon, command, name)
440434
end
441435
end
442436
elseif file_type == "wpe" then
443437
if platform == "pc" then
444438
-- NTLDR only supports (hdx,y)
445439
if device_type == "1" then
446-
if grub.file_exist ("/NTBOOT.MOD/NTBOOT.PE1") then
447-
-- NTBOOT NT5 PE
448-
icon = "nt5"
449-
tog4dpath (file, device, device_type)
450-
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT pe1=" .. g4d_file .. "\";" ..
451-
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
452-
name = grub.gettext("Boot NT5.x PE (NTBOOT)")
453-
grub.add_icon_menu (icon, command, name)
454-
end
440+
-- NTBOOT NT5 PE
441+
icon = "nt5"
442+
tog4dpath (file, device, device_type)
443+
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT pe1=" .. g4d_file .. "\";" ..
444+
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
445+
name = grub.gettext("Boot NT5.x PE (NTBOOT)")
446+
grub.add_icon_menu (icon, command, name)
455447
end
456448
end
457449
elseif file_type == "vhd" then
@@ -465,36 +457,33 @@ function open (file, file_type, device, device_type, arch, platform)
465457
if platform == "pc" then
466458
-- BOOTMGR only supports (hdx,y)
467459
if device_type == "1" then
468-
if grub.file_exist ("/NTBOOT.MOD/NTBOOT.NT6") then
469-
-- NTBOOT NT6 VHD
470-
icon = "nt6"
471-
tog4dpath (file, device, device_type)
472-
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT NT6=" .. g4d_file .. "\";" ..
473-
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
474-
name = grub.gettext("Boot Windows NT6.x VHD (NTBOOT)")
475-
grub.add_icon_menu (icon, command, name)
476-
-- VHD ramos -top
477-
icon = "nt6"
478-
command = "g4d_cmd=\"find --set-root --ignore-floppies --ignore-cd " .. g4d_file .. "; map --mem --top " .. g4d_file .. " (hd0); map (hd0) (hd1); map --hook; root (hd0,0); chainloader /bootmgr; boot\"; " ..
479-
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
480-
name = grub.gettext("Boot RamOS VHD (GRUB4DOS map --mem --top)")
481-
grub.add_icon_menu (icon, command, name)
482-
-- VHD ramos
483-
icon = "nt6"
484-
command = "g4d_cmd=\"find --set-root --ignore-floppies --ignore-cd " .. g4d_file .. "; map --mem " .. g4d_file .. " (hd0); map (hd0) (hd1); map --hook; root (hd0,0); chainloader /bootmgr; boot\"; " ..
485-
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
486-
name = grub.gettext("Boot RamOS VHD (GRUB4DOS map --mem)")
487-
grub.add_icon_menu (icon, command, name)
488-
end
489-
if grub.file_exist ("/vbootldr") then
490-
icon = "img"
491-
vhd_path = string.match (grub.getenv ("file"), "^%([%w,]+%)(.*)$")
492-
grub.run ("probe --set=dev_uuid -u " .. device)
493-
dev_uuid = grub.getenv ("dev_uuid")
494-
command = "loopback vboot /vbootldr; set vbootloader=(vboot)/vboot;vbootinsmod (vboot)/vbootcore.mod; vboot harddisk=(UUID=" .. dev_uuid .. ")" .. vhd_path
495-
name = grub.gettext("Boot VHD (vboot)")
496-
grub.add_icon_menu (icon, command, name)
497-
end
460+
-- NTBOOT NT6 VHD
461+
icon = "nt6"
462+
tog4dpath (file, device, device_type)
463+
command = "g4d_cmd=\"find --set-root /fm.loop;/NTBOOT NT6=" .. g4d_file .. "\";" ..
464+
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
465+
name = grub.gettext("Boot Windows NT6.x VHD (NTBOOT)")
466+
grub.add_icon_menu (icon, command, name)
467+
-- VHD ramos -top
468+
icon = "nt6"
469+
command = "g4d_cmd=\"find --set-root --ignore-floppies --ignore-cd " .. g4d_file .. "; map --mem --top " .. g4d_file .. " (hd0); map (hd0) (hd1); map --hook; root (hd0,0); chainloader /bootmgr; boot\"; " ..
470+
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
471+
name = grub.gettext("Boot RamOS VHD (GRUB4DOS map --mem --top)")
472+
grub.add_icon_menu (icon, command, name)
473+
-- VHD ramos
474+
icon = "nt6"
475+
command = "g4d_cmd=\"find --set-root --ignore-floppies --ignore-cd " .. g4d_file .. "; map --mem " .. g4d_file .. " (hd0); map (hd0) (hd1); map --hook; root (hd0,0); chainloader /bootmgr; boot\"; " ..
476+
"linux $prefix/grub.exe --config-file=$g4d_cmd; "
477+
name = grub.gettext("Boot RamOS VHD (GRUB4DOS map --mem)")
478+
grub.add_icon_menu (icon, command, name)
479+
-- VHD vboot
480+
icon = "img"
481+
vhd_path = string.match (grub.getenv ("file"), "^%([%w,]+%)(.*)$")
482+
grub.run ("probe --set=dev_uuid -u " .. device)
483+
dev_uuid = grub.getenv ("dev_uuid")
484+
command = "loopback vboot /vbootldr; set vbootloader=(vboot)/vboot;vbootinsmod (vboot)/vbootcore.mod; vboot harddisk=(UUID=" .. dev_uuid .. ")" .. vhd_path
485+
name = grub.gettext("Boot VHD (vboot)")
486+
grub.add_icon_menu (icon, command, name)
498487
end
499488
elseif platform == "efi" then
500489
if arch == "x86_64" then

0 commit comments

Comments
 (0)