#802 #889 #890 ogGrubInstallPartitions, ogGrubInstallMbr y ogRestoreEfiBootLoader: Format EFI partition if it is not. ogGetEsp: Detecting the EFI partition does not require VFAT filesystem.

remotes/github/pjlink
Irina Gomez 2019-02-04 11:34:26 +01:00
parent 20e5aa9e45
commit e9601e1f70
3 changed files with 19 additions and 6 deletions

View File

@ -821,7 +821,11 @@ PREFIXSECONDSTAGE="/boot/grubMBR"
if ogIsEfiActive; then
read EFIDISK EFIPART <<< $(ogGetEsp)
# Comprobamos que exista ESP y el directorio para ubuntu
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART)
if [ $? -ne 0 ]; then
ogFormat $EFIDISK $EFIPART FAT32
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
fi
EFISUBDIR=$(printf "Part-%02d-%02d" $DISK $PART)
[ -d ${EFISECONDSTAGE}/EFI/$EFISUBDIR ] || mkdir -p ${EFISECONDSTAGE}/EFI/$EFISUBDIR
EFIOPTGRUB=" --target x86_64-efi --efi-directory=${EFISECONDSTAGE}/EFI/$EFISUBDIR "
@ -943,7 +947,11 @@ PREFIXSECONDSTAGE="/boot/grubPARTITION"
if ogIsEfiActive; then
read EFIDISK EFIPART <<< $(ogGetEsp)
# Comprobamos que exista ESP y el directorio para ubuntu
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART)
if [ $? -ne 0 ]; then
ogFormat $EFIDISK $EFIPART FAT32
EFISECONDSTAGE=$(ogMount $EFIDISK $EFIPART) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
fi
EFISUBDIR=$(printf "Part-%02d-%02d" $DISK $PART)
[ -d ${EFISECONDSTAGE}/EFI/$EFISUBDIR ] || mkdir -p ${EFISECONDSTAGE}/EFI/$EFISUBDIR
EFIOPTGRUB=" --target x86_64-efi --efi-directory=${EFISECONDSTAGE}/EFI/$EFISUBDIR "

View File

@ -258,7 +258,7 @@ ogCreatePartitionTable $ND
# Definir particiones y notificar al kernel.
# Borramos primero las particiones y luego creamos las nuevas
sgdisk $DELOPTIONS $OPTIONS $DISK 2>/dev/null && partprobe $DISK
[ -n "$CACHESIZE" ] && ogMountCache 2>/dev/null
[ -n "$CACHESIZE" ] && ogMountCache 2>/dev/null || return 0
}
@ -684,8 +684,9 @@ echo $TYPE
function ogGetEsp ()
{
local PART d
for d in $(blkid -t TYPE=vfat -o device); do
PART="$(ogDevToDisk $d)"
for d in $(blkid -o device|sort); do
# Previene error para /dev/loop0
PART="$(ogDevToDisk $d 2>/dev/null)" || continue
if [ "$(ogGetPartitionId $PART)" == "$(ogTypeToId EFI GPT)" ]; then
echo $PART
break

View File

@ -159,7 +159,11 @@ fi
# Comprobamos que exista partición de sistema y la ESP
MNTDIR=$(ogMount $1 $2) || ogRaiseError $OG_ERR_PARTITION "$DISK $PART" || return $?
EFIDIR=$(ogMount $(ogGetEsp)) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
EFIDIR=$(ogMount $(ogGetEsp))
if [ "$EFIDIR" == "" ]; then
ogFormat $(ogGetEsp) FAT32
EFIDIR=$(ogMount $(ogGetEsp)) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
fi
# Comprobamos que exista el cargador
#BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)