mount: use the ubi class to check for attached devices
Use the generic sys class to check if a mtd device is attached. The virtual node may not be present in some kernel versions. Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
55b313e7d2
commit
e2caf16da4
|
|
@ -146,8 +146,8 @@ if [ "${SUBSYSTEM}" = "block" ]; then
|
|||
elif [ "${SUBSYSTEM}" = "mtd" ]; then
|
||||
# Before attaching, find out if partition already attached
|
||||
MTD_NUM="$(echo ${MTDN} | sed -ne 's,.*mtd\([0-9]\+\),\1,g;T;p')"
|
||||
for ubidev in /sys/devices/virtual/ubi/*; do
|
||||
echo "${ubidev}" | grep -qs '/sys/devices/virtual/ubi/\*' && continue
|
||||
for ubidev in /sys/class/ubi/*; do
|
||||
echo "${ubidev}" | grep -qs '/sys/class/ubi/\*' && continue
|
||||
mtd_att="$(cat ${ubidev}/mtd_num)"
|
||||
if [ "${mtd_att}" = "${MTD_NUM}" ]; then
|
||||
dev_number="$(echo ${ubidev} | sed -ne 's,.*ubi\([0-9]\+\),\1,g;T;p')"
|
||||
|
|
|
|||
Loading…
Reference in New Issue