summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorIrina Gómez <irinagomez@us.es>2019-02-04 11:34:26 +0100
committerIrina Gómez <irinagomez@us.es>2019-02-04 11:34:26 +0100
commite9601e1f70519e9e380e6198e29df2f695ffbd94 (patch)
treea6dec5245cad8aa129baca5e42742498ca2c262e /client
parent20e5aa9e4558004d6d46fddd033f04d59afe61a0 (diff)
#802 #889 #890 ogGrubInstallPartitions, ogGrubInstallMbr y ogRestoreEfiBootLoader: Format EFI partition if it is not. ogGetEsp: Detecting the EFI partition does not require VFAT filesystem.
Diffstat (limited to 'client')
-rwxr-xr-xclient/engine/Boot.lib12
-rwxr-xr-xclient/engine/Disk.lib7
-rw-r--r--client/engine/UEFI.lib6
3 files changed, 19 insertions, 6 deletions
diff --git a/client/engine/Boot.lib b/client/engine/Boot.lib
index 09337657..9c6d9990 100755
--- a/client/engine/Boot.lib
+++ b/client/engine/Boot.lib
@@ -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 "
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib
index 50ce04e8..050438d7 100755
--- a/client/engine/Disk.lib
+++ b/client/engine/Disk.lib
@@ -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
diff --git a/client/engine/UEFI.lib b/client/engine/UEFI.lib
index 7a1afb6d..84cfb65a 100644
--- a/client/engine/UEFI.lib
+++ b/client/engine/UEFI.lib
@@ -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)