From 137ceb4b55c804b1b66baf970450b4f6733bc02f Mon Sep 17 00:00:00 2001 From: Irina Gómez Date: Wed, 14 Aug 2019 12:32:48 +0200 Subject: #802 #888 PXE templates for UEFI: 'default' and '1hd' support secure boot for 'rEFInd'. 'default' searches for installed boot loaders and displays a menu. 'ogLiveAdmin' only starts from the network (not from the cache) --- server/tftpboot/grub/default | 95 ++++++++++++++++--------------- server/tftpboot/grub/templates/10 | 20 +------ server/tftpboot/grub/templates/19pxeADMIN | 19 +------ 3 files changed, 53 insertions(+), 81 deletions(-) (limited to 'server/tftpboot') diff --git a/server/tftpboot/grub/default b/server/tftpboot/grub/default index 85342b49..6c505de6 100644 --- a/server/tftpboot/grub/default +++ b/server/tftpboot/grub/default @@ -1,64 +1,65 @@ # Busca cargadores existentes por orden de prioridad e # inicia el primero que encuentra. # Si no existe ningún cargador de arranque muestre mensaje de error. -set timeout=0 - -# Valor si no detecto ningún sistema -set label="OpenGnsys: Ningún cargador de arranque detectado." -set chain="" +set timeout=5 +set detectado='no' # Compruebo si existen distintos cargadores. -set root='' echo "Searching rEFInd" -search --file --set root /EFI/refind/grubx64.efi -if [ "$root" != "" ]; then - set label="rEFInd" - set chain="chainloader /EFI/refind/grubx64.efi" +search --file --set rootRefind /EFI/refind/shimx64.efi.signed +if [ "$rootRefind" != "" ]; then + set detectado='si' + menuentry "rEFInd" { + root="$rootRefind" + chainloader /EFI/refind/shimx64.efi.signed +} fi -if [ "$root" == "" ]; then - echo "Searching Part-01-02" - search --file --set root /EFI/Part-01-02/Boot/ogloader.efi - if [ "$root" != "" ]; then - set label="Part-01-02" - set chain="chainloader /EFI/Part-01-02/Boot/ogloader.efi" - 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 -if [ "$root" == "" ]; then - echo "Searching Part-01-03" - search --file --set root /EFI/Part-01-03/Boot/ogloader.efi - if [ "$root" != "" ]; then - set label="Part-01-03" - set chain="chainloader /EFI/Part-01-03/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 -if [ "$root" == "" ]; then - echo "Searching Microsoft" - search --file --set root /EFI/Microsoft/Boot/bootmgfw.efi - if [ "$root" != "" ]; then - set label="Microsoft" - set chain="chainloader /EFI/Microsoft/Boot/bootmgfw.efi" - fi +echo "Searching Microsoft" +search --file --set rootMS /EFI/Microsoft/Boot/bootmgfw.efi +if [ "$rootMS" != "" ]; then + set detectado='si' + menuentry "Microsoft" { + root="$rootMS" + chainloader /EFI/Microsoft/Boot/bootmgfw.efi + } fi -if [ "$root" == "" ]; then - echo "Searching Ubuntu" - search --file --set root /EFI/ubuntu/grubx64.efi - if [ "$root" != "" ]; then - set label="Ubuntu" - set chain="chainloader /EFI/ubuntu/grubx64.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 -if [ "$root" != "" ]; then - set label="OpenGnsys ha detectado: $label" -else - # para evitar mensajes de error. - set root="(hd0,gpt1)" -fi -menuentry "$label" { - eval "$chain" -} +# Si no hay ningún sistam 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 diff --git a/server/tftpboot/grub/templates/10 b/server/tftpboot/grub/templates/10 index 4271840e..82c44464 100644 --- a/server/tftpboot/grub/templates/10 +++ b/server/tftpboot/grub/templates/10 @@ -1,20 +1,6 @@ ##NO-TOCAR-ESTA-LINEA 1hd -set timeout=0 - -# Compruebo si existe rEFInd -set root='' echo "rEFInd" -search --file --set root /EFI/refind/grubx64.efi -if [ "$root" == "" ]; then - set label="rEFInd no está instalado" - set chain="" -else - set label="rEFInd" - set chain="chainloader /EFI/refind/grubx64.efi" -fi -menuentry "$label" { - root='hd0,gpt1' - eval "$chain" - boot -} +root='hd0,gpt1' +chainloader /EFI/refind/shimx64.efi.signed +boot diff --git a/server/tftpboot/grub/templates/19pxeADMIN b/server/tftpboot/grub/templates/19pxeADMIN index 494ba87d..211a543b 100644 --- a/server/tftpboot/grub/templates/19pxeADMIN +++ b/server/tftpboot/grub/templates/19pxeADMIN @@ -3,24 +3,9 @@ set timeout=0 set timeout_style=hidden set ISODIR=ogLive +set default=0; -# Si existe ogLive en CACHE lo inicio, si no el de la red -set root='' -echo "OgLive CACHE" -search --file --set root /boot/$ISODIR/ogvmlinuz -if [ "$root" == "" ]; then - echo "OgLive $ISODIR" - set default=1; -else - set default=0; -fi - -menuentry "OgLive CACHE" { - linux /boot/$ISODIR/ogvmlinuz ro boot=oginit quiet splash vga=788 irqpoll acpi=on og2nd=sqfs ogprotocol=smb ogactiveadmin=true ogdebug=true ogupdateinitrd=true ogtmpfs=15 oglivedir=$ISODIR INFOHOST - initrd /boot/$ISODIR/oginitrd.img - boot -} - +echo "OgLive $ISODIR" menuentry "OgLive $ISODIR" { # Si no existe el ogLive de ISODIR en la red, inicio ogLive por defecto for DIR in $ISODIR ogLive; do -- cgit v1.2.3-18-g5258