summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorMuhammad Hamza <Muhammad_Hamza@mentor.com>2022-07-17 14:56:42 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-25 15:11:46 +0100
commit2d0aed6469d91e9e9cd9e9778fcd1cbc4b259dd6 (patch)
tree1f9cf53c118ae36bb9ded639fb5bdaf09283144f /meta/recipes-core/udev
parent88bc9d2b93de490d33f23244dca1e8ae7db7fb44 (diff)
downloadpoky-2d0aed6469d91e9e9cd9e9778fcd1cbc4b259dd6.tar.gz
udev-extraconf/mount.sh: add LABELs to mountpoints
This alters the mountpoints such that if a device has a LABEL or a PARTLABEL, it will be mounted at e.g.: /run/media/$LABEL-<device-node> /run/media/$PARTLABEL-<device-node> /run/media/rootfs-sda2 otherwise the device will be mounted at e.g.: /run/media/<device-node> /run/media/sda1 The <device-node> appended with LABEL or PARTLABEL makes sure that the mountpoint is unique, therefore, avoids overlapping mounts. (From OE-Core rev: 229e7a911a8b1e0223cfee0bdc2f5fc79cf300fe) Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com> Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> (cherry picked from commit a9a0a0967832445f1bcc65d58f95343d1b562e1b) Signed-off-by: Ming Liu <liu.ming50@gmail.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh18
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb2
2 files changed, 19 insertions, 1 deletions
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index c8b773bc07..40910be8bd 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -54,6 +54,9 @@ automount_systemd() {
54 grep "^[[:space:]]*$tmp" /etc/fstab && return 54 grep "^[[:space:]]*$tmp" /etc/fstab && return
55 done 55 done
56 56
57 # Get the unique name for mount point
58 get_label_name "${DEVNAME}"
59
57 [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" 60 [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name"
58 61
59 MOUNT="$MOUNT -o silent" 62 MOUNT="$MOUNT -o silent"
@@ -94,6 +97,9 @@ automount() {
94 # configured in fstab 97 # configured in fstab
95 grep -q "^$DEVNAME " /proc/mounts && return 98 grep -q "^$DEVNAME " /proc/mounts && return
96 99
100 # Get the unique name for mount point
101 get_label_name "${DEVNAME}"
102
97 ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" 103 ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name"
98 # Silent util-linux's version of mounting auto 104 # Silent util-linux's version of mounting auto
99 if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; 105 if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
@@ -134,6 +140,18 @@ rm_dir() {
134 fi 140 fi
135} 141}
136 142
143get_label_name() {
144 # Get the LABEL or PARTLABEL
145 LABEL=`/sbin/blkid | grep "$1:" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
146 # If the $DEVNAME has a LABEL or a PARTLABEL
147 if [ -n "$LABEL" ]; then
148 # Set the mount location dir name to LABEL appended
149 # with $name e.g. label-sda. That would avoid overlapping
150 # mounts in case two devices have same LABEL
151 name="${LABEL}-${name}"
152 fi
153}
154
137# No ID_FS_TYPE for cdrom device, yet it should be mounted 155# No ID_FS_TYPE for cdrom device, yet it should be mounted
138name="`basename "$DEVNAME"`" 156name="`basename "$DEVNAME"`"
139[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media` 157[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb
index 2b908ac05b..8213c1a930 100644
--- a/meta/recipes-core/udev/udev-extraconf_1.1.bb
+++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -38,7 +38,7 @@ do_install() {
38} 38}
39 39
40FILES:${PN} = "${sysconfdir}/udev" 40FILES:${PN} = "${sysconfdir}/udev"
41RDEPENDS:${PN} = "udev" 41RDEPENDS:${PN} = "udev util-linux-blkid"
42CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" 42CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist"
43 43
44# to replace udev-extra-rules from meta-oe 44# to replace udev-extra-rules from meta-oe