summaryrefslogtreecommitdiffstats
path: root/client
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
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')
-rwxr-xr-xclient/engine/Disk.lib16
-rw-r--r--client/engine/UEFI.lib36
-rwxr-xr-xclient/shared/scripts/bootOsCustom.template4
-rw-r--r--client/shared/scripts/configureOsCustom.template2
4 files changed, 21 insertions, 37 deletions
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib
index 06744bd9..50ce04e8 100755
--- a/client/engine/Disk.lib
+++ b/client/engine/Disk.lib
@@ -1024,6 +1024,9 @@ echo "$TYPE"
#@version 1.0 - Versión en pruebas.
#@author Ramon Gomez, ETSII Universidad de Sevilla
#@date 2010/01/12
+#@version 1.1.1 - Se incluye tipo Windows para UEFI (ticket #802)
+#@author Irina Gomez, ETSII Universidad de Sevilla
+#@date 2019/01/18
#*/ ##
function ogHidePartition ()
{
@@ -1046,6 +1049,7 @@ case "$TYPE" in
FAT32) NEWTYPE="HFAT32" ;;
FAT16) NEWTYPE="HFAT16" ;;
FAT12) NEWTYPE="HFAT12" ;;
+ WINDOWS)NEWTYPE="WIN-RESERV";;
*) ogRaiseError $OG_ERR_PARTITION "$TYPE"
return $? ;;
esac
@@ -1595,6 +1599,9 @@ echo $ID
#@version 1.0 - Versión en pruebas.
#@author Ramon Gomez, ETSII Universidad de Sevilla
#@date 2010/01/12
+#@version 1.1.1 - Se incluye tipo Windows Reserver para UEFI (ticket #802)
+#@author Irina Gomez, ETSII Universidad de Sevilla
+#@date 2019/01/18
#*/ ##
function ogUnhidePartition ()
{
@@ -1613,10 +1620,11 @@ PART=$(ogDiskToDev "$1" "$2") || return $?
# Obtener tipo de partición.
TYPE=$(ogGetPartitionType "$1" "$2")
case "$TYPE" in
- HNTFS) NEWTYPE="NTFS" ;;
- HFAT32) NEWTYPE="FAT32" ;;
- HFAT16) NEWTYPE="FAT16" ;;
- HFAT12) NEWTYPE="FAT12" ;;
+ HNTFS) NEWTYPE="NTFS" ;;
+ HFAT32) NEWTYPE="FAT32" ;;
+ HFAT16) NEWTYPE="FAT16" ;;
+ HFAT12) NEWTYPE="FAT12" ;;
+ WIN-RESERV) NEWTYPE="WINDOWS" ;;
*) ogRaiseError $OG_ERR_PARTITION "$TYPE"
return $? ;;
esac
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
diff --git a/client/shared/scripts/bootOsCustom.template b/client/shared/scripts/bootOsCustom.template
index b457fde4..06046526 100755
--- a/client/shared/scripts/bootOsCustom.template
+++ b/client/shared/scripts/bootOsCustom.template
@@ -50,11 +50,11 @@ case "$OSTYPE" in
#echo "[40] Activar particion de Windows $PART y ocultar las demás."
#for (( i=1; i<=$(ogGetPartitionsNumber $DISK); i++ )); do
# if [ $i == $PART -o $i == $PARTDATA ]; then
- # [ $(ogGetPartitionType $DISK $PART) == "HNTFS" ] && ogUnhidePartition $1 $PART
+ # [ $(ogGetPartitionType $DISK $PART) == "HNTFS" -o $(ogGetPartitionType $DISK $PART) == "WIN-RESERV" ] && ogUnhidePartition $1 $PART
# # Activo la particion si no es de datos
# [ $i -ne $PARTDATA ] && ogSetPartitionActive $DISK $i
# else
- # [ "$(ogGetPartitionType $DISK $i)" == NTFS ] && ogHidePartition $DISK $i
+ # [ "$(ogGetPartitionType $DISK $i)" == NTFS -o "$(ogGetPartitionType $DISK $i)" == "WINDOWS" ] && ogHidePartition $DISK $i
# fi
#done
;;
diff --git a/client/shared/scripts/configureOsCustom.template b/client/shared/scripts/configureOsCustom.template
index 66be3c63..920e6b3c 100644
--- a/client/shared/scripts/configureOsCustom.template
+++ b/client/shared/scripts/configureOsCustom.template
@@ -28,7 +28,7 @@ IMGNAME="$4" # Nombre canónico de imagen (sin extensión).
# Nota: incluye llamada al script "configureOs" para realizar previamente una configuración estándar.
# Configurarción típica.
-configureOs "$1" "$2"
+configureOs "$DISK" "$PART" "$REPO" "$IMGNAME"
# Postconfiguración personalizada para cada tipo de sistema operativo.
OSTYPE="$(ogGetOsType $1 $2)"
case "$OSTYPE" in