mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
88bc9d2b93
commit
2d0aed6469
@@ -54,6 +54,9 @@ automount_systemd() {
|
|||||||
grep "^[[:space:]]*$tmp" /etc/fstab && return
|
grep "^[[:space:]]*$tmp" /etc/fstab && return
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Get the unique name for mount point
|
||||||
|
get_label_name "${DEVNAME}"
|
||||||
|
|
||||||
[ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name"
|
[ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name"
|
||||||
|
|
||||||
MOUNT="$MOUNT -o silent"
|
MOUNT="$MOUNT -o silent"
|
||||||
@@ -94,6 +97,9 @@ automount() {
|
|||||||
# configured in fstab
|
# configured in fstab
|
||||||
grep -q "^$DEVNAME " /proc/mounts && return
|
grep -q "^$DEVNAME " /proc/mounts && return
|
||||||
|
|
||||||
|
# Get the unique name for mount point
|
||||||
|
get_label_name "${DEVNAME}"
|
||||||
|
|
||||||
! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name"
|
! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name"
|
||||||
# Silent util-linux's version of mounting auto
|
# Silent util-linux's version of mounting auto
|
||||||
if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
|
if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
|
||||||
@@ -134,6 +140,18 @@ rm_dir() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_label_name() {
|
||||||
|
# Get the LABEL or PARTLABEL
|
||||||
|
LABEL=`/sbin/blkid | grep "$1:" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
|
||||||
|
# If the $DEVNAME has a LABEL or a PARTLABEL
|
||||||
|
if [ -n "$LABEL" ]; then
|
||||||
|
# Set the mount location dir name to LABEL appended
|
||||||
|
# with $name e.g. label-sda. That would avoid overlapping
|
||||||
|
# mounts in case two devices have same LABEL
|
||||||
|
name="${LABEL}-${name}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# No ID_FS_TYPE for cdrom device, yet it should be mounted
|
# No ID_FS_TYPE for cdrom device, yet it should be mounted
|
||||||
name="`basename "$DEVNAME"`"
|
name="`basename "$DEVNAME"`"
|
||||||
[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
|
[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ do_install() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILES:${PN} = "${sysconfdir}/udev"
|
FILES:${PN} = "${sysconfdir}/udev"
|
||||||
RDEPENDS:${PN} = "udev"
|
RDEPENDS:${PN} = "udev util-linux-blkid"
|
||||||
CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist"
|
CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist"
|
||||||
|
|
||||||
# to replace udev-extra-rules from meta-oe
|
# to replace udev-extra-rules from meta-oe
|
||||||
|
|||||||
Reference in New Issue
Block a user