diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-03-10 13:06:03 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-03-10 13:07:24 +0200 |
commit | 7df52204369d587df3dc321f12a1a5408afe66bd (patch) | |
tree | adbcb73eef5b68d9c2dce3186eebd2f043c27bad | |
parent | fbd356ce3a284d5445181f70e0f40572c81da66d (diff) |
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 <laurent.pinchart@ideasonboard.com>
-rwxr-xr-x | kflash.sh | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |