Fix $sduuid being overlapped by a probable emmc device existing
- if $emmccheck is not empty, then exclude this from the lookups for $sdblkid - simplified $sduuid assignment within a single line closes AR-1611
This commit is contained in:
parent
0bd6fea636
commit
142dec4618
@ -63,13 +63,14 @@ mtdcheck=$(grep 'mtdblock' /proc/partitions | awk '{print $NF}' | xargs)
|
||||
|
||||
# SD card boot part - to be considered more than one entry on various platforms
|
||||
# UUID=xxx...
|
||||
# 1 - Lookup mmc devices excluding the mmc device probably providing the current root partition:
|
||||
sdblkid=$(blkid -o full /dev/mmcblk*p1 | grep -v "$root_partition_device")
|
||||
# 2 - If there is nothing, then lookup any mmc partition matching /dev/mmcblk*p1:
|
||||
[[ -z $sdblkid ]] && sdblkid=$(blkid -o full /dev/mmcblk*p1)
|
||||
# 3 - Extract the UUID from $sdblkid via regex:
|
||||
sduuid=$(echo "$sdblkid" | sed -nE 's/^.*[[:space:]]UUID="([0-9a-zA-Z-]*)".*/\1/p')
|
||||
[[ -n $sduuid ]] && sduuid="UUID=${sduuid}"
|
||||
# 1 - Lookup mmc devices excluding the mmc device probably providing the current root partition as well as a probable emmc device found above:
|
||||
[[ -z $emmccheck ]] && sdblkid=$(blkid -o full /dev/mmcblk*p1 | grep -v "$root_partition_device")
|
||||
[[ -n $emmccheck ]] && sdblkid=$(blkid -o full /dev/mmcblk*p1 | grep -v "$root_partition_device" | grep -v "$emmccheck")
|
||||
# 2 - If there is nothing, then lookup any mmc partition matching /dev/mmcblk*p1 excluding probable emmc device found above
|
||||
[[ -z $sdblkid && -z $emmccheck ]] && sdblkid=$(blkid -o full /dev/mmcblk*p1)
|
||||
[[ -z $sdblkid && -n $emmccheck ]] && sdblkid=$(blkid -o full /dev/mmcblk*p1 | grep -v "$emmccheck")
|
||||
# 3 - Extract the UUID=<uuid> from $sdblkid via regex without " - as e.g.: UUID=2e1d1509-a8fc-4f8b-8a51-88fb8593f8d6
|
||||
sduuid=$(echo "$sdblkid" | sed -nE 's/^.*[[:space:]](UUID="[0-9a-zA-Z-]*").*/\1/p' | tr -d '"')
|
||||
|
||||
#recognize EFI
|
||||
[[ -d /sys/firmware/efi ]] && DEVICE_TYPE="uefi"
|
||||
@ -855,7 +856,7 @@ main()
|
||||
if [[ -n $emmccheck ]]; then
|
||||
umount_device "$emmccheck"
|
||||
format_emmc "$emmccheck"
|
||||
else
|
||||
else
|
||||
umount_device '/dev/nand'
|
||||
format_nand
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user