]> code.ossystems Code Review - openembedded-core.git/commitdiff
udev-extraconf: update mount.sh to use /run/media instead of /media
authorDenys Dmytriyenko <denys@ti.com>
Tue, 1 Apr 2014 03:54:11 +0000 (03:54 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 25 Apr 2014 16:12:25 +0000 (17:12 +0100)
This is done to work around the issue of auto-mounting block devices
(i.e. SD cards) when root filesystem is still in read-only mode and
creating /media/<device> mount-points by udev is not possible. That
is due to udev (/etc/rcS.d/S03udev) getting started earlier than
checkroot (/etc/rcS.d/S10checkroot.sh) gets a chance to re-mount the
rootfs as read-write.

Although, canonical FHS specifies /media/<device> as a mount point
for removable media devices, the latest 2.3 version was released in
2004 and since then FreeDesktop/udisks and other tools adopted the
new /run/media/<user>/<device> location. That was done to overcome
read-only rootfs limitation, since /run is usually a tmpfs mounted
partition, plus avoid name-clash between users.

For our embedded systems environment we assume single-user operation
and hence simplify mount point to just /run/media/<device>. But for
proper per-user mounting to /run/media/<user>/<device>, some sort of
session management is required along with the tool like udisks, that
is out of scope of this simple udev-based auto-mounting.

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/udev/udev-extraconf/mount.sh
meta/recipes-core/udev/udev-extraconf_1.1.bb [moved from meta/recipes-core/udev/udev-extraconf_1.0.bb with 99% similarity]

index cb57e47a90623f581722572bc09f932e9f444ab8..3e4f21f2eb20760034bbbb1b41ff0fc41c5c522d 100644 (file)
@@ -20,7 +20,7 @@ done
 automount() {  
        name="`basename "$DEVNAME"`"
 
-       ! test -d "/media/$name" && mkdir -p "/media/$name"
+       ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
        # Silent util-linux's version of mounting auto
        if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
        then
@@ -38,12 +38,12 @@ automount() {
                ;;
        esac
 
-       if ! $MOUNT -t auto $DEVNAME "/media/$name"
+       if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
        then
-               #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
-               rm_dir "/media/$name"
+               #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
+               rm_dir "/run/media/$name"
        else
-               logger "mount.sh/automount" "Auto-mount of [/media/$name] successful"
+               logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
                touch "/tmp/.automount-$name"
        fi
 }
@@ -60,7 +60,7 @@ rm_dir() {
 
 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"
-[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
+[ -e /sys/block/$name/device/run/media ] && media_type=`cat /sys/block/$name/device/run/media`
 
 if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
        if [ -x "$PMOUNT" ]; then
@@ -87,5 +87,5 @@ if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
        
        # Remove empty directories from auto-mounter
        name="`basename "$DEVNAME"`"
-       test -e "/tmp/.automount-$name" && rm_dir "/media/$name"
+       test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
 fi
similarity index 99%
rename from meta/recipes-core/udev/udev-extraconf_1.0.bb
rename to meta/recipes-core/udev/udev-extraconf_1.1.bb
index 3810b28155af8460c553b3f8927f1c867faf0b07..d69056dd767800cd3659566eb857f6e652ab42ba 100644 (file)
@@ -4,8 +4,6 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-PR = "r16"
-
 SRC_URI = " \
        file://automount.rules \
        file://mount.sh \