mount_digiparts.sh: some script improvements

* Use 'MOUNT' variable instead of 'mount' command
* On the MTD subsystem event, stop looping once the UBI device number is found

Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2022-11-18 10:42:52 +01:00
parent ff06521485
commit 883141830a
1 changed files with 2 additions and 1 deletions

View File

@ -86,6 +86,7 @@ elif [ "${SUBSYSTEM}" = "mtd" ]; then
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')"
break
fi
done
@ -96,7 +97,7 @@ elif [ "${SUBSYSTEM}" = "mtd" ]; then
# Check if volume exists.
if ubinfo /dev/ubi${dev_number} -N ${PARTNAME} >/dev/null 2>&1; then
# Mount the volume.
if ! mount -t ubifs ubi${dev_number}:${PARTNAME} ${MOUNT_PARAMS} ${MOUNTPOINT}; then
if ! ${MOUNT} -t ubifs ubi${dev_number}:${PARTNAME} ${MOUNT_PARAMS} ${MOUNTPOINT}; then
logger -t udev "ERROR: Could not mount '${PARTNAME}' partition"
rmdir --ignore-fail-on-non-empty ${MOUNTPOINT}
fi