ogboot/tftpboot/ipxe_scripts/templates/menu

75 lines
2.5 KiB
Plaintext

#!ipxe
# Detectar si se está ejecutando en modo UEFI o BIOS
iseq ${platform} efi && goto uefi_boot || goto bios_boot
:bios_boot
set timeout 3000
set esc:hex 1b
set bold ${esc:string}[1m
set boldoff ${esc:string}[22m
set fg_cya ${esc:string}[36m
set fg_whi ${esc:string}[37m
set ISODIR __OGLIVE__
set default 0
set kernelargs __INFOHOST__
:main_menu
clear menu
menu ${bold}${fg_cya}OpenGnsys iPXE Disk Boot Menu${boldoff}
item mbr Boot MBR (entire disk)
item part1 FirstDisk-FirstPartition
item part2 FirstHardDisk-SecondPartition
item part3 FirstDisk-ThirdPartition
item ogcache OpenGnsys CACHE
item ognet OpenGnsys NET
item ognetdef OpenGnsys NET Default
item shell iPXE Shell
choose --timeout ${timeout} --default mbr target && goto ${target}
:mbr
echo Booting MBR...
chain http://__SERVERIP__/tftpboot/grub.exe --config-file="timeout 1; title MBR; chainloader (hd0)+1; rootnoverify (hd0); boot" || echo Failed to boot MBR
exit
:part1
echo Booting FirstDisk-FirstPartition...
chain http://__SERVERIP__/tftpboot/grub.exe --config-file="timeout 1; title FirstDisk-FirstPartition; root (hd0,0); chainloader (hd0,0)+1; boot" || echo Failed to boot part1
exit
:part2
echo Booting FirstHardDisk-SecondPartition...
chain http://__SERVERIP__/tftpboot/grub.exe --config-file="timeout 1; title FirstHardDisk-SecondPartition; root (hd0,1); chainloader (hd0,1)+1; boot" || echo Failed to boot part2
exit
:part3
echo Booting FirstDisk-ThirdPartition...
chain http://__SERVERIP__/tftpboot/grub.exe --config-file="timeout 1; title FirstDisk-ThirdPartition; root (hd0,2); chainloader (hd0,2)+1; boot" || echo Failed to boot part3
exit
:ogcache
echo Booting OpenGnsys-CACHE...
chain http://__SERVERIP__/tftpboot/grub.exe --config-file="timeout 1; title OpenGnsys-CACHE; find --set-root /boot/__OGLIVE__/ogvmlinuz; kernel /boot/__OGLIVE__/ogvmlinuz ogactiveadmin=true ogdebug=true __INFOHOST__; initrd /boot/__OGLIVE__/oginitrd.img; boot"
:ognet
echo Booting OpenGnsys-NET...
kernel http://__SERVERIP__/tftpboot/${ISODIR}/ogvmlinuz ogactiveadmin=false ogdebug=false ${kernelargs} || goto fallback
initrd http://__SERVERIP__/tftpboot/${ISODIR}/oginitrd.img
boot
:ognetdef
echo Booting OpenGnsys-NET Default...
set ISODIR ogLive
kernel http://__SERVERIP__/tftpboot/${ISODIR}/ogvmlinuz ogactiveadmin=false ogdebug=false ${kernelargs}
initrd http://__SERVERIP__/tftpboot/${ISODIR}/oginitrd.img
boot
:shell
echo Launching iPXE shell...
shell
:uefi_boot
echo "Running in UEFI mode - Booting Menu"
chain http://__SERVERIP__/tftpboot/grubx64.efi
exit