summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rwxr-xr-xclient/engine/Boot.lib17
-rwxr-xr-xclient/shared/lib/os-probes/mounted/efi/31part-x-y28
-rwxr-xr-xclient/shared/scripts/grubSyntax27
3 files changed, 56 insertions, 16 deletions
diff --git a/client/engine/Boot.lib b/client/engine/Boot.lib
index 61e90afe..d98b972f 100755
--- a/client/engine/Boot.lib
+++ b/client/engine/Boot.lib
@@ -846,7 +846,7 @@ if ogIsEfiActive; then
ogFormat $EFIDISK $EFIPART FAT32
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
fi
- EFISUBDIR=$(printf "Part-%02d-%02d" $DISK $PART)
+ EFISUBDIR="grub"
# Borramos la configuración anterior
[ -d ${EFISECONDSTAGE}/EFI/$EFISUBDIR ] && rm -rf ${EFISECONDSTAGE}/EFI/$EFISUBDIR
mkdir -p ${EFISECONDSTAGE}/EFI/$EFISUBDIR/Boot
@@ -1586,16 +1586,13 @@ function ogBootLoaderDeleteEntry ()
#@version 1.1.1 - Se incluye comentarios en codigo para autodocuemtnacion con Doxygen
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2018-07-05
-#@version 1.1.1 - UEFI: Es necesario grub.cfg para detectar parametros del kernel. Si no existe se recupera backup temporalmente (ticket #802 #890)
-#@author Irina Gomez, ETSII Universidad de Sevilla
-#@date 2019-03-13
#*/ ##
function ogBurgInstallMbr ()
{
# Variables locales.
-local PART DISK FIRSTAGE SECONSTAGE PREFIXSECONDSTAGE CHECKOS KERNELPARAM BACKUPNAME FILECFG RECOVERBACKUP
+local PART DISK FIRSTAGE SECONSTAGE PREFIXSECONDSTAGE CHECKOS KERNELPARAM BACKUPNAME FILECFG
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
@@ -1649,13 +1646,6 @@ fi
#llamada a updateBootCache para que aloje la primera fase del ogLive
updateBootCache
-# Si no existe el fichero grub.cfg pero sí el backup lo recupero (para UEFI)
-if ogIsEfiActive && [ -f ${SECONDSTAGE}/boot/grub/grub.cfg$BACKUPNAME ]; then
- [ -f ${SECONDSTAGE}/boot/grub/grub.cfg ] || mv ${SECONDSTAGE}/boot/grub/grub.cfg$BACKUPNAME ${SECONDSTAGE}/boot/grub/grub.cfg
- RECOVERYBACKUP=TRUE
-fi
-
-
#Configur la sintaxis grub para evitar menus de "recovery" en el OGLive
echo "GRUB_DISABLE_RECOVERY=\"true\"" >> /etc/default/grub
echo "GRUB_DISABLE_LINUX_UUID=\"true\"" >> /etc/default/grub
@@ -1757,9 +1747,6 @@ EOF
#Preparar configuración segunda etapa: crear entrada del sistema operativo
grubSyntax "$KERNELPARAM" >> "$FILECFG"
-# Si hemos recuperado el backup del grub, volvemos a la situación original
-[ "$RECOVERYBACKUP" == TRUE ] && mv ${SECONDSTAGE}/boot/grub/grub.cfg ${SECONDSTAGE}/boot/grub/grub.cfg$BACKUPNAME
-
#Instalar el burg
burg-install --force --root-directory=${SECONDSTAGE} $FIRSTSTAGE 2>&1>/dev/null
}
diff --git a/client/shared/lib/os-probes/mounted/efi/31part-x-y b/client/shared/lib/os-probes/mounted/efi/31part-x-y
new file mode 100755
index 00000000..349c36d8
--- /dev/null
+++ b/client/shared/lib/os-probes/mounted/efi/31part-x-y
@@ -0,0 +1,28 @@
+#!/bin/sh
+# OG: Detects Microsoft bootloader on a EFI System Partition in directory Part-xx-yy (#802 #888)
+
+. /usr/share/os-prober/common.sh
+
+efi="$1"
+
+found=
+for microsoft in $(item_in_dir Part-..-.. "$efi"); do
+ for boot in $(item_in_dir boot "$efi/$microsoft"); do
+ bcd=$(item_in_dir bcd "$efi/$microsoft/$boot")
+ bootmgfw=$(item_in_dir bootmgfw.efi "$efi/$microsoft/$boot")
+ if [ -n "$bcd" -a -n "$bootmgfw" ]; then
+ long="Windows Boot Manager"
+ short=Windows
+ path="$microsoft/$boot/$bootmgfw"
+ found=true
+ break
+ fi
+ done
+done
+
+
+if [ -n "$found" ]; then
+ label="$(count_next_label "$short")"
+ result "${path}:${long}:${label}"
+fi
+exit 0
diff --git a/client/shared/scripts/grubSyntax b/client/shared/scripts/grubSyntax
index 2c82e2e9..aa1adb2e 100755
--- a/client/shared/scripts/grubSyntax
+++ b/client/shared/scripts/grubSyntax
@@ -8,6 +8,7 @@ set -e
#Antonio Doblas Viso
#Universidad de Málaga
#@version 1.1.1 - En los parámetros del kernel se sustituye el UUID por el dispositivo.
+#@version 1.1.1 - Detecta cargador de Windows en directorio Part-xx-yy dentro de ESP (#802 #888)
DISK=
PART=
@@ -32,7 +33,13 @@ fi
grub_probe=${grub_probe:-$OGBIN/grub-probe1.99_$(arch)}
#librerias del osProber para kernel antiguos: detecta e identifica sistema operativos.
-grub-install --version | grep 1.99 && cp -r /opt/opengnsys/lib/os-probes/* /usr/lib/os-probes/
+if grub-install --version | grep 1.99 ; then
+ cp -r /opt/opengnsys/lib/os-probes/* /usr/lib/os-probes/
+else
+ # Librería os-probe para cargador de microsoft en dir part-x-y (uefi)
+ OSPROBE_MS_PART="/opt/opengnsys/lib/os-probes/mounted/efi/31part-x-y"
+ [ -f $OSPROBE_MS_PART ] && cp $OSPROBE_MS_PART /usr/lib/os-probes/mounted/efi
+fi
#Autoreconocimiento del ogLive en cache
@@ -342,6 +349,24 @@ EOF
}
EOF
;;
+ efi)
+
+ found_other_os=1
+ EFIPATH=${DEVICE#*@}
+ DEVICE=${DEVICE%@*}
+ onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
+ cat << EOF
+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
+EOF
+ save_default_entry | sed -e "s/^/\t/"
+#ADV prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+ OG_prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+
+ cat <<EOF
+ chainloader ${EFIPATH}
+}
+EOF
+ ;;
linux)
KERNELPARAM=""
#linuxprobed detecta todos los kernels de una partición.