Open hakuna-m opened 8 years ago
I seem to recall there was a problem with different languages. In this commit I removed the text part of the check in response to a user (can't recall all the details). Although that wasn't an either or (it was both type and description), so this is better.
Thank you for your response.
I seem to recall there was a problem with different languages.
Currently, the old problem should be not affect the new layout which is only used for GPT tables because the new column has no localization. I tested it with German localization. There was no difference even e.g. "Windows recovery environment" is not German. But maybe, there would be a difference in future releases.
Maybe a solution would be to disable localization for the fdisk commands with a leading LC_ALL=C
e.g.:
--- 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 [ $(LC_ALL=C 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 [ $(LC_ALL=C 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
That's a great idea. I'll update it when I get a chance. Thanks
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:
.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: