From 7df52204369d587df3dc321f12a1a5408afe66bd Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 10 Mar 2021 13:06:03 +0200 Subject: kflash: Use block device LABEL attribute if PARTLABEL isn't available If the partition table doesn't support labels, use the filesystem label as a fallback. Signed-off-by: Laurent Pinchart --- kflash.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kflash.sh b/kflash.sh index dd3a7d9..e5f59ee 100755 --- a/kflash.sh +++ b/kflash.sh @@ -193,8 +193,12 @@ probe_device() { local part_label=${flash_part[1]} local part_dev=/dev/${partdev}${part_idx} - local label=$(blkid ${part_dev} -s PARTLABEL | sed 's/.*PARTLABEL="\([^"]*\)"$/\1/') - if [[ $label != ${part_label} ]] ; then + local label=$(blkid ${part_dev} -o value -s PARTLABEL) + if [[ -z "$label" ]] ; then + label=$(blkid ${part_dev} -o value -s LABEL) + fi + + if [[ "$label" != ${part_label} ]] ; then echo "Partition ${part_dev} has label '$label', expected '${part_label}'" >&2 return fi -- cgit v1.2.3