recovery-initramfs: fix multi-MTD detection when formatting NAND partitions

Commit 7e81e706a1 modified the logic used to
determine if a NAND is using multi-MTD or single-MTD, but single quotes were
used in the grep pattern, which prevents the variable inside from expanding.
This makes the script always enter the single-MTD code path, even in multi-MTD
systems, which breaks partition formatting in these cases.

Replace the single quotes with double quotes so the variable can expand and the
condition can be properly checked.

https://onedigi.atlassian.net/browse/DEL-8773

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2023-12-20 13:44:08 +01:00
parent 85a659dd11
commit 90afd7025c
1 changed files with 1 additions and 1 deletions

View File

@ -233,7 +233,7 @@ format_ubi_volume() {
# If the system is a multi-MTD, there must be an MTD partition by the
# same name as the UBI volume
result="$(grep '\"${1}\"$' /proc/mtd)"
result="$(grep "\"${1}\"$" /proc/mtd)"
if [ -n "${result}" ]; then
# Find the MTD partition.
local mtd_num="$(sed -ne "s/mtd\([0-9]\+\):.*\<${1}\>.*/\1/g;T;p" /proc/mtd 2>/dev/null)"