Skip to content

Commit

Permalink
Updated main configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mexit committed Apr 6, 2024
1 parent 9ab7a87 commit a94175a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ One device with multiple ISO files. Easy to use: install once, add ISO files and
- Boot Linux from .iso files
- Boot Windows 10/11 installer from ISO (currently, SB must be disabled during installation)
- Boot Linux installer from network (experimental)
- Boot locally installed systems
- Boot locally installed systems: Linux, Windows
- Automatically update configuration files
- Without background services
- exFAT file system support
Expand Down
93 changes: 47 additions & 46 deletions config/grub.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,28 @@ if loadfont unicode; then
fi

function find_grub_cfg {
submenu "Detect and boot from GRUB config file (grub.cfg) -->" {
submenu "Detect GRUB config file (grub.cfg) -->" {
grubcfg_found=false

insmod ext2
insmod xfs
insmod zfs
insmod btrfs
insmod jfs
insmod reiserfs

for grubcfg in (*,msdos*)/boot/grub*/grub.cfg (*,gpt*)/boot/grub*/grub.cfg ; do
regexp --set=1:grubcfg_device '^\((.*)\)/' "${grubcfg}"
if [ -e "${grubcfg}" ]; then
grubcfg_found=true

menuentry --class=linux "Try boot from: ${grubcfg}" "${grubcfg}" "${grubcfg_device}" {
root="${3}"
configfile "${2}"
}
fi
for grubcfg in (*,*)/boot/grub*/grub.cfg; do
regexp --set=1:grubcfg_device '^\((.*)\)/' "${grubcfg}"
if [ -f "${grubcfg}" ]; then
grubcfg_found=true
menuentry --class=linux "Boot Linux from: ${grubcfg}" "${grubcfg}" "${grubcfg_device}" {
root="(${3})"
configfile "${2}"
}
fi
done

if [ "${grubcfg_found}" != true ]; then
menuentry "GRUB config files (grub.cfg) not detected." { false }
menuentry "GRUB configuration files (grub.cfg) not found..." { false }
fi
}
}
Expand All @@ -93,32 +91,30 @@ submenu "Auto-detect ISOs (Directory: $iso_dir) -->" {

if [ "${grub_platform}" == "pc" ]; then
submenu "Tools -->" {
submenu "Detect Windows bootloaders -->" {
submenu "Detect Windows Boot Manager -->" {
bootmgr_found=false

for bootmgr in (*,msdos*)/bootmgr (*,gpt*)/bootmgr ; do
regexp --set=1:bootmgr_device '^\((.*)\)/' "${bootmgr}"
if [ -e "${bootmgr}" ]; then
bootmgr_found=true
insmod ntldr

menuentry --class=windows "Boot Windows from: ${bootmgr}" "${bootmgr}" "${bootmgr_device}" {
root="${3}"
ntldr "${2}"
}
fi
for bootmgr in (*,*)/bootmgr; do
regexp --set=1:bootmgr_device '^\((.*)\)/' "${bootmgr}"
if [ -f "${bootmgr}" ]; then
bootmgr_found=true
insmod ntldr
menuentry --class=windows "Windows Boot Manager on (${bootmgr_device})" "${bootmgr_device}" {
root="(${2})"
ntldr "(${2})/bootmgr"
}
fi
done

if [ "${bootmgr_found}" != true ]; then
menuentry "Windows bootloaders not detected." { false }
menuentry "Windows Boot Manager not found." { false }
fi
}

# Menu: boot from GRUB config file
find_grub_cfg

file="/MultiOS-USB/tools/mt86plus_*/memtest64.bin"
if [ -e ${file} ]; then
if [ -f ${file} ]; then
menuentry "Memtest86+" {
linux16 ${file}
}
Expand Down Expand Up @@ -146,31 +142,36 @@ if [ "${grub_platform}" == "efi" ]; then
fwsetup
}

if [ -e ($dev,gpt1)/efi/boot/mmx64.efi ]; then
if [ -f ($dev,1)/efi/boot/mmx64.efi ]; then
menuentry --class=efi "Add UEFI key or hash" {
chainloader ($dev,gpt1)/efi/boot/mmx64.efi
chainloader ($dev,1)/efi/boot/mmx64.efi
}
fi

if [ -e /MultiOS-USB/tools/efitools-*/KeyTool.efi ]; then
if [ -f /MultiOS-USB/tools/efitools-*/KeyTool.efi ]; then
menuentry --class=efi "Manage UEFI keys and hashes" {
chainloader /MultiOS-USB/tools/efitools-*/KeyTool.efi
}
fi

submenu "Detect EFI bootloaders -->" {
efi_found=false

for efi in (*,gpt*)/efi/*/*.efi (*,gpt*)/efi/*/*/*.efi (*,gpt*)/*.efi (*,gpt*)/*/*.efi ; do
regexp --set=1:efi_device '^\((.*)\)/' "${efi}"
if [ -e "${efi}" ]; then
efi_found=true

menuentry --class=efi "${efi}" "${efi_device}" {
root="${2}"
chainloader "${1}"
}
fi
for efi in (*,*)/efi/*/*/*.efi (*,*)/efi/*/*.efi (*,*)/efi/*.efi; do
regexp --set=1:efi_device '^\((.*)\)/' "${efi}"
if [ -f "${efi}" ]; then
efi_found=true
if [ ${efi} == (${efi_device})/efi/Microsoft/Boot/bootmgfw.efi ]; then
menuentry --class=efi "Windows Boot Manager on (${efi_device})" "${efi_device}" {
root="(${2})"
chainloader "(${2})/efi/Microsoft/Boot/bootmgfw.efi"
}
else
menuentry --class=efi "${efi}" "${efi_device}" {
root="(${2})"
chainloader "${1}"
}
fi
fi
done

if [ "${efi_found}" != true ]; then
Expand All @@ -182,15 +183,15 @@ if [ "${grub_platform}" == "efi" ]; then
find_grub_cfg

file="/MultiOS-USB/tools/mt86plus_*/memtest64.efi"
if [ -e ${file} ]; then
if [ -f ${file} ]; then
menuentry --class=efi "Memtest86+ EFI" {
chainloader ${file}
}
fi
}

submenu "Network bootable OS installers (DHCP) -->" {
if net_bootp ; then
if net_bootp; then
source /MultiOS-USB/config/grub_netboot/main.cfgnet
else
echo -e "\n\nIf your network card is not detected,"
Expand Down Expand Up @@ -253,6 +254,6 @@ submenu "GRUB2 options -->" {
}
}

menuentry "Reboot" --hotkey=R --class reboot { reboot }
menuentry "Reboot (r)" --hotkey=r --class reboot { reboot }

menuentry "Power Off" --hotkey=P --class shutdown { halt }
menuentry "Power Off (p)" --hotkey=p --class shutdown { halt }

0 comments on commit a94175a

Please sign in to comment.