summaryrefslogtreecommitdiffstats
path: root/client/engine/UEFI.lib
diff options
context:
space:
mode:
authorIrina Gómez <irinagomez@us.es>2019-01-21 14:05:18 +0100
committerIrina Gómez <irinagomez@us.es>2019-01-21 14:05:18 +0100
commita31f7a97b1516650135bca967949f430158491e8 (patch)
tree8439f203c30f1ae4656b32c6f474ccb196be9c24 /client/engine/UEFI.lib
parentf028c363411c0b4e28f7a2aba36404ea921f14aa (diff)
#802 #889 ogHidePartition and ogUnhidePartition: Add Windows and Windows Reserved Partitions. ogSaveImageInfo and ogRestoreUuidPartitions: Only save/restore GUID Partition Table.
Diffstat (limited to 'client/engine/UEFI.lib')
-rw-r--r--client/engine/UEFI.lib36
1 files changed, 6 insertions, 30 deletions
diff --git a/client/engine/UEFI.lib b/client/engine/UEFI.lib
index e64f99f2..f87e2ce0 100644
--- a/client/engine/UEFI.lib
+++ b/client/engine/UEFI.lib
@@ -189,8 +189,8 @@ esac
#@exception OG_ERR_FORMAT Formato incorrecto.
#@exception OG_ERR_NOTFOUND No encontrado fichero de información de la imagen (con uuid)
function ogRestoreUuidPartitions () {
-local DISK PART IMGNAME INFOFILE DEVICE PARTDEVICE DATA GUID UUID IMGGUID IMGUUID
-local EFIPARTDEVICE EFIDEVICE EFIDATA EFIGUID EFIUUID EFIUUID IMGEFIGUID IMGEFIUUID
+local DISK PART IMGNAME INFOFILE DEVICE DATA GUID UUID IMGGUID
+local EFIDEVICE EFIDATA EFIGUID EFIUUID EFIUUID IMGEFIGUID
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
@@ -214,20 +214,15 @@ DISK=$3
PART=$4
DEVICE=$(ogDiskToDev $DISK)
-PARTDEVICE=$(ogDiskToDev $DISK $PART) || return $?
read -e EFIDISK EFIPART <<<"$(ogGetEsp)"
-EFIPARTDEVICE=$(ogDiskToDev $EFIDISK $EFIPART) || return $?
# Datos de la imagen
IMGGUID=$(jq .guid $INFOFILE|tr -d \")
-IMGUUID=$(jq .uuid $INFOFILE|tr -d \")
IMGEFIGUID=$(jq .espguid $INFOFILE|tr -d \")
-IMGEFIUUID=$(jq .espuuid $INFOFILE|tr -d \")
# Datos actuales
DATA=$(sfdisk -J $DEVICE)
GUID=$(echo $DATA|jq ".partitiontable|.id"|tr -d \")
-UUID=$(echo $DATA|jq ".partitiontable.partitions[]|select(.node==\"$PARTDEVICE\").uuid"|tr -d \")
if [ "$IMGGUID" != "$GUID" ]; then
echo sgdisk -U "$IMGGUID" "$DEVICE"
@@ -235,13 +230,6 @@ if [ "$IMGGUID" != "$GUID" ]; then
partprobe
fi
-if [ "$IMGUUID" != "$UUID" ]; then
- NUMPART="${PARTDEVICE##$DEVICE}"
- echo sgdisk -u "${NUMPART}:$IMGUUID" "$DEVICE"
- sgdisk -u "${NUMPART}:$IMGUUID" "$DEVICE"
- partprobe
-fi
-
if [ $DISK -eq $EFIDISK ]; then
EFIDATA=$DATA
EFIDEVICE=$DEVICE
@@ -256,13 +244,6 @@ echo sgdisk -U "$IMGEFIGUID" "$EFIDEVICE"
fi
fi
-EFIUUID=$(echo $EFIDATA|jq ".partitiontable.partitions[]|select(.node==\"$EFIPARTDEVICE\").uuid"|tr -d \")
-if [ "$IMGEFIUUID" != "$EFIUUID" ]; then
- EFINUMPART="${EFIPARTDEVICE##$EFIDEVICE}"
- echo sgdisk -u "${EFINUMPART}:$IMGEFIUUID" "$EFIDEVICE"
- sgdisk -u "${EFINUMPART}:$IMGEFIUUID" "$EFIDEVICE"
- partprobe
-fi
}
# ogSaveImageInfo
@@ -274,8 +255,8 @@ fi
#@exception OG_ERR_FORMAT formato incorrecto.
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
function ogSaveImageInfo () {
-local DISK PART IMGDIR IMGNAME INFO INFOFILE DEVICE PARTDEVICE DATA GUID UUID
-local EFIPARTDEVICE EFIDEVICE EFIDATA EFIUUID EFIGUID
+local DISK PART IMGDIR IMGNAME INFO INFOFILE DEVICE DATA GUID
+local EFIPARTDEVICE EFIDEVICE EFIDATA EFIGUID
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
@@ -295,14 +276,12 @@ IMGNAME="$(basename "$4")"
INFOFILE="$IMGDIR/.$IMGNAME.img.json"
DEVICE=$(ogDiskToDev $DISK) || return $?
-PARTDEVICE=$(ogDiskToDev $DISK $PART) || return $?
DATA=$(sfdisk -J $DEVICE)
GUID=$(echo $DATA|jq ".partitiontable|.id"|tr -d \")
-UUID=$(echo $DATA|jq ".partitiontable.partitions[]|select(.node==\"$PARTDEVICE\").uuid"|tr -d \")
# Información de la imagen. Valor inicial de efi: false
INFO=$(cat << EOT | jq .
-{"name":"$IMGNAME","efi":"false","guid":"$GUID","uuid":"$UUID"}
+{"name":"$IMGNAME","efi":"false","guid":"$GUID"}
EOT
)
@@ -318,16 +297,13 @@ if ogIsEfiActive; then
EFIDATA=$DATA
EFIGUID=$GUID
else
- EFIDEVICE=$(ogDiskToDev $EFIDISK) || return $?
+ EFIDEVICE=$(ogDiskToDev $EFIDISK)
EFIDATA=$(sfdisk -J $EFIDEVICE)
EFIGUID=$(echo $EFIDATA|jq ".partitiontable|.id"|tr -d \")
fi
- EFIUUID=$(echo $EFIDATA|jq ".partitiontable.partitions[]|select(.node==\"$EFIPARTDEVICE\").uuid"|tr -d \")
# Incluyo valor de EFIGUID (por si partición EFI en distinto disco que la de sistema)
INFO=$(echo $INFO| jq --arg aux $EFIGUID '. + {espguid: $aux}')
- # Incluyo valor de EFIUUID
- INFO=$(echo $INFO| jq --arg aux $EFIUUID '. + {espuuid: $aux}')
fi
cat << EOT | jq . > $INFOFILE