Adds new template menu to boot disk partition and cache and adds ogliveadmnin kernel param
ogboot/pipeline/head This commit looks good Details

main
Luis Gerardo Romero Garcia 2025-06-18 08:45:17 +02:00
parent a4fd473a57
commit fec97eca8f
6 changed files with 133 additions and 5 deletions

View File

@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [0.7.2] - 2024-06-05
### Changed
- Añade scripts de grub y menu.lst para el arranque por disco y partición
- Añade plantilla ogliveadmin con permisos de administracion como parametro del kernel
- Añade plantilla de menú para el arranque por disco y partición y caché
## [0.7.1] - 2024-05-19
### Changed

View File

@ -1590,7 +1590,7 @@ public function createBootFile(Request $request): JsonResponse
}
// Construcción de los argumentos del kernel
$kernelArgs = 'ro boot=oginit quiet splash irqpoll acpi=on og2nd=sqfs ogprotocol=smb ogactiveadmin=true ogdebug=true ogtmpfs=15 ' .
$kernelArgs = 'ro boot=oginit quiet splash irqpoll acpi=on og2nd=sqfs ogprotocol=smb ogdebug=true ogtmpfs=15 ' .
'oglivedir=${ISODIR}' . ' ' .
'LANG=' . $parameters['LANG'] . ' ' .
'ip=' . $parameters['ip'] . ':' . $serverIp . ':' . $parameters['router'] . ':' . $parameters['netmask'] . ':' . $parameters['computer_name'] . ':' . $parameters['netiface'] . ':none ' .
@ -1651,9 +1651,13 @@ public function createBootFile(Request $request): JsonResponse
$pxeFileName = '01-' . $mac;
$pxeFilePath = $templateCacheDir . '/' . $pxeFileName;
// Generar archivo si la plantilla es oglives cache
if ($templateName === 'ogliveCache') {
$templateCachePath = $templateCacheDir . '/templateCache';
// Generar archivo si la plantilla es oglives cache o menu
if ($templateName === 'ogliveCache' || $templateName === 'menu') {
if ($templateName === 'ogliveCache') {
$templateCachePath = $templateCacheDir . '/templateCache';
} elseif ($templateName === 'menu') {
$templateCachePath = $templateCacheDir . '/templateMenu';
}
$templateCacheContent = file_get_contents($templateCachePath);
$grubContent = str_replace(
['__INFOHOST__', '__OGLIVE__'],

View File

@ -0,0 +1,14 @@
#!ipxe
# Detectar si se está ejecutando en modo UEFI o BIOS
iseq ${platform} efi && goto uefi_boot || goto bios_boot
:bios_boot
echo "Running in BIOS mode - Booting Menu WIP"
chain http://__SERVERIP__/tftpboot/grub.exe --config-file="timeout 0; title menu WIP;root (hd0,0);chainloader (hd0,0)+1;boot" || echo "Failed to boot in BIOS mode"
exit
:uefi_boot
echo "Running in UEFI mode - Booting Menu"
chain http://__SERVERIP__/tftpboot/grubx64.efi
exit

View File

@ -0,0 +1,19 @@
#!ipxe
set timeout 0
set timeout-style hidden
set ISODIR __OGLIVE__
set default 0
set kernelargs __INFOHOST__
# Menú de entrada para seleccionar OgLive
:try_iso
kernel http://__SERVERIP__/tftpboot/${ISODIR}/ogvmlinuz ogactiveadmin=true ${kernelargs} || goto fallback
initrd http://__SERVERIP__/tftpboot/${ISODIR}/oginitrd.img
boot
:fallback
echo "OgLive default"
set ISODIR ogLive
kernel http://__SERVERIP__/tftpboot/${ISODIR}/ogvmlinuz ogactiveadmin=true ${kernelargs}
initrd http://__SERVERIP__/tftpboot/${ISODIR}/oginitrd.img
boot

View File

@ -1 +1,3 @@
configfile __DISKPART__/efi/Part-__DISK__-__PART__/Boot/grub.cfg
search --file --set root /EFI/Part-__DISK__-__PART__/Boot/ogloader.efi
chainloader /EFI/Part-__DISK__-__PART__/Boot/ogloader.efi
boot

View File

@ -0,0 +1,87 @@
set timeout=30
set detectado='no'
# Compruebo si existen distintos cargadores.
echo "Searching Grub"
set ISODIR=__OGLIVE__
search --file --set rootGrub /EFI/grub/Boot/grubx64.efi
if [ "$rootGrub" != "" ]; then
set detectado='si'
menuentry "Grub" {
root="$rootGrub"
chainloader /EFI/grub/Boot/grubx64.efi
}
fi
echo "Searching rEFInd"
search --file --set rootRefind /EFI/refind/shimx64.efi.signed
if [ "$rootRefind" != "" ]; then
menuentry "rEFInd" {
root="$rootRefind"
chainloader /EFI/refind/shimx64.efi.signed
}
fi
echo "Searching Part-01-02"
search --file --set rootP2 /EFI/Part-01-02/Boot/ogloader.efi
if [ "$rootP2" != "" ]; then
set detectado='si'
menuentry "Part-01-02" {
root="$rootP2"
chainloader /EFI/Part-01-02/Boot/ogloader.efi
}
fi
echo "Searching Part-01-03"
search --file --set rootP3 /EFI/Part-01-03/Boot/ogloader.efi
if [ "$rootP3" != "" ]; then
set detectado='si'
menuentry "Part-01-03" {
root="$rootP3"
chainloader /EFI/Part-01-03/Boot/ogloader.efi
}
fi
echo "Searching Windows"
search --file --set rootMS /EFI/Microsoft/Boot/bootmgfw.efi
if [ "$rootMS" != "" ]; then
set detectado='si'
menuentry "Windows" {
root="$rootMS"
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
fi
echo "Searching Ubuntu"
search --file --set rootUb /EFI/ubuntu/grubx64.efi
if [ "$rootUb" != "" ]; then
set detectado='si'
menuentry "Ubuntu"{
root="$rootUb"
chainloader /EFI/ubuntu/grubx64.efi
}
fi
echo "Buscando ogvmlinuz en particiones locales..."
search --file --set=rootOgCache /boot/$ISODIR/ogvmlinuz
if [ "$rootOgCache" != "" ]; then
set detectado='si'
menuentry "Oglive Cache"{
root="$rootOgCache"
linux /boot/$ISODIR/ogvmlinuz __INFOHOST__
initrd /boot/$ISODIR/oginitrd.img
}
fi
# Si no hay ningún sistema operativo muestro mensaje.
if [ $detectado == 'no' ]; then
menuentry "OpenGnsys no ha detectado ningún sistema operativo" {
# para evitar mensajes de error.
set root="(hd0,gpt1)"
}
fi