-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
The output of fdisk 2.20.1 (version for 14.04) is something like this:
/dev/sda1 1 9999999999 999999999+ ee GPT
The output of fdisk 2.27.1 (version for 16.04) is something like this:
/dev/sda1 999999999 999999999 999999999 999G Windows recovery environment
/dev/sda2 999999999 999999999 999999999 999G EFI System
/dev/sda3 999999999 999999999 999999999 999G Microsoft reserved
/dev/sda4 999999999 999999999 999999999 999G Microsoft basic data
/dev/sda5 999999999 999999999 999999999 999G Linux filesystem
/dev/sda6 999999999 999999999 999999999 999G Linux Swap
/dev/sda7 999999999 999999999 999999999 999G Windows recovery environment
.i.e fdisk shows all partitions but no IDs like 83 as used for non-GPT tables.
As a result the script fails e.g. with
partition /dev/sda5 must be type 83 - Linux.
My suggestion is that the script should accept the ID or the type name:
--- a/check-target.sh
+++ b/check-target.sh
@@ -147,11 +147,11 @@
elif [ $(fdisk -l "$partition_disk" | grep "$1[ \t]" | grep "[ \t]85[ \t]" | wc -l) -eq 1 ]; then
error "partition "$1" is an Extended partition."
elif [ "$2" == "83" ]; then
- if [ $(fdisk -l "$partition_disk" | grep "$1[ \t]" | grep "[ \t]"$2"[ \t]" | wc -l) -eq 0 ]; then
+ if [ $(fdisk -l "$partition_disk" | grep "$1[ \t]" | grep -i "[ \t]"$2"[ \t]\|[ \t]Linux filesystem" | wc -l) -eq 0 ]; then
error "partition "$1" must be type "$2" - Linux."
fi
else
- if [ $(fdisk -l "$partition_disk" | grep "$1[ \t]" | grep "[ \t]"$2"[ \t]" | wc -l) -eq 0 ]; then
+ if [ $(fdisk -l "$partition_disk" | grep "$1[ \t]" | grep -i "[ \t]"$2"[ \t]\|[ \t]Linux Swap" | wc -l) -eq 0 ]; then
error "partition "$1" must be type "$2" - Linux swap."
fi
fi
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels