]> code.ossystems Code Review - openembedded-core.git/commitdiff
busybox/mdev-mount.sh: Fix partition detect and cleanup mountpoint on fail
authorMike Looijmans <mike.looijmans@topic.nl>
Fri, 24 Aug 2018 07:21:44 +0000 (09:21 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 28 Aug 2018 09:27:15 +0000 (10:27 +0100)
This fixes issues mainly seen when mounting eMMC devices:

The wildcard /sys/block/${DEVBASE}/${DEVBASE}*1 matches both "mmcblk0p1"
and "mmcblk0boot1" for example, and this results in syntax errors. Fix this
by searching for a "partition" file instead, which only exists for real
partitions and not 'fakes' like the eMMC extra's.

When mount fails, the mountpoint file is left behind, causing later attempts
at auto-mounting it to fail. If mount fails, remove the mountpoint, leaving
the system in the state as it was before the mount attempt.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/busybox/files/mdev-mount.sh

index b4385a157f2ad39f3da7fc8d284347bcd0317c8a..130e9472f3b51157261a2a726a9e05e8c4e48372 100644 (file)
@@ -25,7 +25,7 @@ case "$ACTION" in
                fi
                # check for full-disk partition
                if [ "${DEVBASE}" = "${MDEV}" ] ; then
-                       if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
+                       if [ -f /sys/block/${DEVBASE}/${DEVBASE}*1/partition ] ; then
                                # Partition detected, just quit
                                exit 0
                        fi
@@ -43,7 +43,7 @@ case "$ACTION" in
                then
                        MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
                        mkdir -p "$MOUNTPOINT"
-                       mount -t auto /dev/$MDEV "$MOUNTPOINT"
+                       mount -t auto /dev/$MDEV "$MOUNTPOINT" || rmdir "$MOUNTPOINT"
                fi
                ;;
        remove)