summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuan Manuel Bardallo juanmanuel.bardallo@sic.uhu.es <juanmanuel.bardallo@sic.uhu.es>2019-07-01 11:49:05 +0200
committerJuan Manuel Bardallo juanmanuel.bardallo@sic.uhu.es <juanmanuel.bardallo@sic.uhu.es>2019-07-01 11:49:05 +0200
commit6d71b90b2adcec08400afadda0f94a57cf22430a (patch)
tree3845870231f7c69dbce6052dd39312e9035216c2
parent102a50e65592c12d75117d79e8fd30200831697a (diff)
ogGetEsp has been modified to handle with nvme disks, in that case, blkid returns
> /dev/loop0 > /dev/nvme0n1 > /dev/nvme0n1p1 When ogDevToDisk processes the line /dev/nvme0n1, $PART contains only one argument corresponding to the disk number, when occurs, ogGetPartitionId throws an error.
-rwxr-xr-xclient/engine/Disk.lib14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib
index 026718b9..f7def42e 100755
--- a/client/engine/Disk.lib
+++ b/client/engine/Disk.lib
@@ -700,9 +700,17 @@ local PART 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
+ # En discos NVMe blkid devuelve una salida del tipo:
+ # >/dev/loop0
+ # >/dev/nvme0n1
+ # >/dev/nvme0n1p1
+ # al analizar la particion nvme0n1, PART solo tiene un argumento y hace que ogGetPartitionId lance un error
+ LEN=$(echo $PART | awk '{ print length($0) }')
+ if [ $LEN -gt 1 ]; then
+ if [ "$(ogGetPartitionId $PART)" == "$(ogTypeToId EFI GPT)" ]; then
+ echo $PART
+ break
+ fi
fi
done
}