udev-extraconf fixes
cover udev-extraconf fixes
From: Ming Liu <[email protected]>
udev-extraconf of kirkstone does not work, back-ported several fixes from upstream.
Ming Liu (3):
udev-extraconf: let automount base directory configurable
udev-extraconf: fix some systemd automount issues udev-extraconf:mount.sh: fix path mismatching issues
Muhammad Hamza (5):
udev-extraconf/mount.sh: add LABELs to mountpoints udev-extraconf/mount.sh: save mount name in our tmp filecache udev-extraconf/mount.sh: only mount devices on hotplug
udev-extraconf: force systemd-udevd to use shared MountFlags udev-extraconf/mount.sh: ignore lvm in automount
Richard Purdie (1):
udev-extraconf/initrdscripts/parted: Rename mount.blacklist ->
mount.ignorelist
.../files/init-install-efi-testfs.sh | 2 +-
.../initrdscripts/files/init-install-efi.sh | 2 +-
.../files/init-install-testfs.sh | 2 +-
.../initrdscripts/files/init-install.sh | 2 +-
.../{mount.blacklist => mount.ignorelist} | 0
.../recipes-core/udev/udev-extraconf/mount.sh | 90 ++++++++++++++-----
meta/recipes-core/udev/udev-extraconf_1.1.bb | 27 ++++--
meta/recipes-extended/parted/files/run-ptest | 6 +-
8 files changed, 95 insertions(+), 36 deletions(-)
rename meta/recipes-core/udev/udev-extraconf/{mount.blacklist => mount.ignorelist} (100%)Signature · 1 line
2.25.1
PATCH 1/9 udev-extraconf/initrdscripts/parted: Rename mount.blacklist -> mount.ignorelist
From: Richard Purdie <[email protected]>
---
.../initrdscripts/files/init-install-efi-testfs.sh | 2 +-
.../initrdscripts/files/init-install-efi.sh | 2 +-
.../initrdscripts/files/init-install-testfs.sh | 2 +-
meta/recipes-core/initrdscripts/files/init-install.sh | 2 +-
.../{mount.blacklist => mount.ignorelist} | 0
meta/recipes-core/udev/udev-extraconf/mount.sh | 4 ++--
meta/recipes-core/udev/udev-extraconf_1.1.bb | 10 +++++-----
meta/recipes-extended/parted/files/run-ptest | 6 +++---
8 files changed, 14 insertions(+), 14 deletions(-)
rename meta/recipes-core/udev/udev-extraconf/{mount.blacklist => mount.ignorelist} (100%)meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh +1 -1
@@ -138,7 +138,7 @@ touch /ssd/etc/controllerimage if [ -d /ssd/etc/ ] ; then # We dont want udev to mount our root device while we're booting... if [ -d /ssd/etc/udev/ ] ; then - echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist + echo "/dev/${device}" >> /ssd/etc/udev/mount.ignorelist fi fi
meta/recipes-core/initrdscripts/files/init-install-efi.sh +1 -1
@@ -229,7 +229,7 @@ if [ -d /tgt_root/etc/ ] ; then echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then - echo "${device}" >> /tgt_root/etc/udev/mount.blacklist + echo "${device}" >> /tgt_root/etc/udev/mount.ignorelist fi fi
meta/recipes-core/initrdscripts/files/init-install-testfs.sh +1 -1
@@ -164,7 +164,7 @@ if [ -d /tgt_root/etc/ ] ; then echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then - echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist + echo "/dev/${device}" >> /tgt_root/etc/udev/mount.ignorelist fi fi umount /tgt_root
meta/recipes-core/initrdscripts/files/init-install.sh +1 -1
@@ -261,7 +261,7 @@ if [ -d /tgt_root/etc/ ] ; then echo "$bootdev /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then - echo "${device}" >> /tgt_root/etc/udev/mount.blacklist + echo "${device}" >> /tgt_root/etc/udev/mount.ignorelist fi fi umount /tgt_root
meta/recipes-core/udev/udev-extraconf/mount.ignorelist renamed from meta/recipes-core/udev/udev-extraconf/mount.blacklist +0 -0
meta/recipes-core/udev/udev-extraconf/mount.sh +2 -2
@@ -26,11 +26,11 @@ fi PMOUNT="/usr/bin/pmount" -for line in `grep -h -v ^# /etc/udev/mount.blacklist /etc/udev/mount.blacklist.d/*` +for line in `grep -h -v ^# /etc/udev/mount.ignorelist /etc/udev/mount.ignorelist.d/*` do if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ]; then - logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" + logger "udev/mount.sh" "[$DEVNAME] is marked to ignore" exit 0 fi done
meta/recipes-core/udev/udev-extraconf_1.1.bb +5 -5
@@ -1,13 +1,13 @@ SUMMARY = "Extra machine specific configuration files" HOMEPAGE = "https://wiki.gentoo.org/wiki/Eudev" -DESCRIPTION = "Extra machine specific configuration files for udev, specifically blacklist information." +DESCRIPTION = "Extra machine specific configuration files for udev, specifically information on devices to ignore." LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SRC_URI = " \ file://automount.rules \ file://mount.sh \ - file://mount.blacklist \ + file://mount.ignorelist \ file://autonet.rules \ file://network.sh \ file://localextra.rules \
@@ -23,8 +23,8 @@ do_install() { install -m 0644 ${WORKDIR}/autonet.rules ${D}${sysconfdir}/udev/rules.d/autonet.rules install -m 0644 ${WORKDIR}/localextra.rules ${D}${sysconfdir}/udev/rules.d/localextra.rules - install -d ${D}${sysconfdir}/udev/mount.blacklist.d - install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -d ${D}${sysconfdir}/udev/mount.ignorelist.d + install -m 0644 ${WORKDIR}/mount.ignorelist ${D}${sysconfdir}/udev/ install -d ${D}${sysconfdir}/udev/scripts/
@@ -37,7 +37,7 @@ do_install() { FILES:${PN} = "${sysconfdir}/udev" RDEPENDS:${PN} = "udev" -CONFFILES:${PN} = "${sysconfdir}/udev/mount.blacklist" +CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" # to replace udev-extra-rules from meta-oe RPROVIDES:${PN} = "udev-extra-rules"
meta/recipes-extended/parted/files/run-ptest +3 -3
@@ -1,7 +1,7 @@ #!/bin/sh -mkdir -p /etc/udev/mount.blacklist.d -echo /dev/sda1 >> /etc/udev/mount.blacklist.d/parted-tmp +mkdir -p /etc/udev/mount.ignorelist.d +echo /dev/sda1 >> /etc/udev/mount.ignorelist.d/parted-tmp rm -f tests/*.log make -C tests test-suite.log -rm /etc/udev/mount.blacklist.d/parted-tmp +rm /etc/udev/mount.ignorelist.d/parted-tmp
Signature · 1 line
2.25.1
PATCH 2/9 udev-extraconf: let automount base directory configurable
In reply to [email protected]From: Ming Liu <[email protected]>
Dont hard-code automount base directory to '/run/media', introduce a variable MOUNT_BASE to let it configurable, like in udisks2 the mount base is also configurable by setting option: --enable-fhs-media.
--- .../recipes-core/udev/udev-extraconf/mount.sh | 25 ++++++++++--------- meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-)
meta/recipes-core/udev/udev-extraconf/mount.sh +13 -12
@@ -6,6 +6,7 @@ BASE_INIT="`readlink -f "@base_sbindir@/init"`" INIT_SYSTEMD="@systemd_unitdir@/systemd" +MOUNT_BASE="@MOUNT_BASE@" if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then # systemd as init uses systemd-mount to mount block devices
@@ -40,7 +41,7 @@ automount_systemd() { # Skip already mounted partitions if [ -f /run/systemd/transient/run-media-$name.mount ]; then - logger "mount.sh/automount" "/run/media/$name already mounted" + logger "mount.sh/automount" "$MOUNT_BASE/$name already mounted" return fi
@@ -53,7 +54,7 @@ automount_systemd() { grep "^[[:space:]]*$tmp" /etc/fstab && return done - [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name" + [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" MOUNT="$MOUNT -o silent"
@@ -70,12 +71,12 @@ automount_systemd() { ;; esac - if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name" + if ! $MOUNT --no-block -t auto $DEVNAME "$MOUNT_BASE/$name" then - #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" - rm_dir "/run/media/$name" + #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"$MOUNT_BASE/$name\" failed!" + rm_dir "$MOUNT_BASE/$name" else - logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" + logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" touch "/tmp/.automount-$name" fi }
@@ -93,7 +94,7 @@ automount() { # configured in fstab grep -q "^$DEVNAME " /proc/mounts && return - ! test -d "/run/media/$name" && mkdir -p "/run/media/$name" + ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" # Silent util-linux's version of mounting auto if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; then
@@ -113,12 +114,12 @@ automount() { ;; esac - if ! $MOUNT -t auto $DEVNAME "/run/media/$name" + if ! $MOUNT -t auto $DEVNAME "$MOUNT_BASE/$name" then - #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" - rm_dir "/run/media/$name" + #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"$MOUNT_BASE/$name\" failed!" + rm_dir "$MOUNT_BASE/$name" else - logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" + logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" touch "/tmp/.automount-$name" fi }
@@ -157,5 +158,5 @@ if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ # Remove empty directories from auto-mounter name="`basename "$DEVNAME"`" - test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name" + test -e "/tmp/.automount-$name" && rm_dir "$MOUNT_BASE/$name" fi
meta/recipes-core/udev/udev-extraconf_1.1.bb +2 -0
@@ -15,6 +15,7 @@ SRC_URI = " \ S = "${WORKDIR}" +MOUNT_BASE = "/run/media" do_install() { install -d ${D}${sysconfdir}/udev/rules.d
@@ -31,6 +32,7 @@ do_install() { install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh + sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts }
Signature · 1 line
2.25.1
PATCH 3/9 udev-extraconf/mount.sh: add LABELs to mountpoints
In reply to [email protected]From: Muhammad Hamza <[email protected]>
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.
--- meta/recipes-core/udev/udev-extraconf/mount.sh | 18 ++++++++++++++++++ meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-)
meta/recipes-core/udev/udev-extraconf/mount.sh +18 -0
@@ -54,6 +54,9 @@ automount_systemd() { grep "^[[:space:]]*$tmp" /etc/fstab && return done + # Get the unique name for mount point + get_label_name "${DEVNAME}" + [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" MOUNT="$MOUNT -o silent"
@@ -94,6 +97,9 @@ automount() { # configured in fstab 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" # Silent util-linux's version of mounting auto if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
@@ -134,6 +140,18 @@ rm_dir() { 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 name="`basename "$DEVNAME"`" [ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
meta/recipes-core/udev/udev-extraconf_1.1.bb +1 -1
@@ -38,7 +38,7 @@ do_install() { } FILES:${PN} = "${sysconfdir}/udev" -RDEPENDS:${PN} = "udev" +RDEPENDS:${PN} = "udev util-linux-blkid" CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" # to replace udev-extra-rules from meta-oe
Signature · 1 line
2.25.1
PATCH 4/9 udev-extraconf/mount.sh: save mount name in our tmp filecache
In reply to [email protected]From: Muhammad Hamza <[email protected]>
Doing this will allow to fetch the exact name created by the auto-mounter during the remove action where depending on the scenario utilities such as the blkid might not be usable due to actual device not being present on the system.
--- meta/recipes-core/udev/udev-extraconf/mount.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-core/udev/udev-extraconf/mount.sh +4 -1
@@ -126,7 +126,10 @@ automount() { rm_dir "$MOUNT_BASE/$name" else logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" - touch "/tmp/.automount-$name" + # The actual device might not be present in the remove event so blkid cannot + # be used to calculate what name was generated here. Simply save the mount + # name in our tmp file. + echo "$name" > "/tmp/.automount-$name" fi }
Signature · 1 line
2.25.1
PATCH 5/9 udev-extraconf/mount.sh: only mount devices on hotplug
In reply to [email protected]From: Muhammad Hamza <[email protected]>
fdisk from util-linux (2.31.1) and above allows the user to manipulate an already mounted device. In order to achieve this functionality it issues a BLKRRPART (block device re-read part) ioctl and in response the kernel generates remove/change/add events if the device is not mounted (manually unmounted etc) which are caught and processed by udev. This causes our auto-mounter to remount everything because it does not keep track and things go out of control.
Differentiating between types of remove events such as the one described above (generated by BLKRRPART) and one where the device is physically plugged out is only possible using the DEVPATH variable which is cleaned up only when the device is actually plugged-out. This fixes the above anomaly by only mounting a device in add event which is cleaned up properly (tmp cache deleted) in the remove event or is not present in the tmp cache while making use of the DEVPATH variable during the remove action.
--- .../recipes-core/udev/udev-extraconf/mount.sh | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-)
meta/recipes-core/udev/udev-extraconf/mount.sh +27 -7
@@ -45,6 +45,13 @@ automount_systemd() { return fi + # Only go for auto-mounting when the device has been cleaned up in remove + # or has not been identified yet + if [ -e "/tmp/.automount-$name" ]; then + logger "mount.sh/automount" "[$MOUNT_BASE/$name] is already cached" + return + fi + # Skip the partition which are already in /etc/fstab grep "^[[:space:]]*$DEVNAME" /etc/fstab && return for n in LABEL PARTLABEL UUID PARTUUID; do
@@ -100,6 +107,13 @@ automount() { # Get the unique name for mount point get_label_name "${DEVNAME}" + # Only go for auto-mounting when the device has been cleaned up in remove + # or has not been identified yet + if [ -e "/tmp/.automount-$name" ]; then + logger "mount.sh/automount" "[$MOUNT_BASE/$name] is already cached" + return + fi + ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" # Silent util-linux's version of mounting auto if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
@@ -172,12 +186,18 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_t fi if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then - for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` - do - $UMOUNT $mnt - done - - # Remove empty directories from auto-mounter name="`basename "$DEVNAME"`" - test -e "/tmp/.automount-$name" && rm_dir "$MOUNT_BASE/$name" + tmpfile=`find /tmp | grep "\.automount-.*${name}$"` + if [ ! -e "/sys/$DEVPATH" -a -e "$tmpfile" ]; then + logger "mount.sh/remove" "cleaning up $DEVNAME, was mounted by the auto-mounter" + for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` + do + $UMOUNT $mnt + done + # Remove mount directory created by the auto-mounter + # and clean up our tmp cache file + mntdir=`cat "$tmpfile"` + rm_dir "$MOUNT_BASE/$mntdir" + rm "$tmpfile" + fi fi
Signature · 1 line
2.25.1
PATCH 6/9 udev-extraconf: force systemd-udevd to use shared MountFlags
In reply to [email protected]From: Muhammad Hamza <[email protected]>
Automounting does not work cleanly in case systemd as well as udev rules are being used simultaneously and in most cases race conditions and unknown behavior can come up. In case we're running on top of systemd we need to make sure that systemd-udevd knows that udev is in play as well and mounting should be done using shared flags. Also as we're using mount from sources other than systemd-mount in current scripts this is the most manageable fix to automounting problems.
--- .../udev/udev-extraconf/systemd-udevd.service | 3 +++ meta/recipes-core/udev/udev-extraconf_1.1.bb | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-core/udev/udev-extraconf/systemd-udevd.service
meta/recipes-core/udev/udev-extraconf/systemd-udevd.service new file +3 -0
@@ -0,0 +1,3 @@ +.include @systemd_unitdir@/system/systemd-udevd.service +[Service] +MountFlags=shared
meta/recipes-core/udev/udev-extraconf_1.1.bb +8 -1
@@ -11,6 +11,7 @@ SRC_URI = " \ file://autonet.rules \ file://network.sh \ file://localextra.rules \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd-udevd.service', '', d)} \ " S = "${WORKDIR}"
@@ -35,9 +36,15 @@ do_install() { sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/systemd/system + install ${WORKDIR}/systemd-udevd.service ${D}${sysconfdir}/systemd/system/systemd-udevd.service + sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/systemd/system/systemd-udevd.service + fi } -FILES:${PN} = "${sysconfdir}/udev" +FILES:${PN} = "${sysconfdir}/udev ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${sysconfdir}/systemd/system/systemd-udevd.service', '', d)}" RDEPENDS:${PN} = "udev util-linux-blkid" CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist"
Signature · 1 line
2.25.1
PATCH 7/9 udev-extraconf/mount.sh: ignore lvm in automount
In reply to [email protected]From: Muhammad Hamza <[email protected]>
Failure message is shown in boot logs when trying to mount lvm as automounter does not handle cases where lvm is mounted. This simply skips lvm while automounting to avoid failure message in boot logs.
--- meta/recipes-core/udev/udev-extraconf/mount.sh | 4 ++++ 1 file changed, 4 insertions(+)
meta/recipes-core/udev/udev-extraconf/mount.sh +4 -0
@@ -76,6 +76,8 @@ automount_systemd() { ;; swap) return ;; + lvm*|LVM*) + return ;; # TODO *) ;;
@@ -129,6 +131,8 @@ automount() { ;; swap) return ;; + lvm*|LVM*) + return ;; # TODO *) ;;
Signature · 1 line
2.25.1
PATCH 8/9 udev-extraconf: fix some systemd automount issues
In reply to [email protected]From: Ming Liu <[email protected]>
The '.include' syntax has been dropped from latest systemd releases, we need drop the systemd-udevd.service here, introduce a postinst function to add "MountFlags=shared" to systemd-udevd.service.
Also lsblk binary is being called in mount.sh automount_systemd function, add it to RDEPENDS.
--- .../udev/udev-extraconf/systemd-udevd.service | 3 --- meta/recipes-core/udev/udev-extraconf_1.1.bb | 20 +++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 meta/recipes-core/udev/udev-extraconf/systemd-udevd.service
meta/recipes-core/udev/udev-extraconf/systemd-udevd.service deleted +0 -3
@@ -1,3 +0,0 @@ -.include @systemd_unitdir@/system/systemd-udevd.service -[Service] -MountFlags=shared
meta/recipes-core/udev/udev-extraconf_1.1.bb +12 -8
@@ -11,7 +11,6 @@ SRC_URI = " \ file://autonet.rules \ file://network.sh \ file://localextra.rules \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd-udevd.service', '', d)} \ " S = "${WORKDIR}"
@@ -36,16 +35,21 @@ do_install() { sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts +} + +pkg_postinst:${PN} () { + if [ -e $D${systemd_unitdir}/system/systemd-udevd.service ]; then + sed -i "/\[Service\]/aMountFlags=shared" $D${systemd_unitdir}/system/systemd-udevd.service + fi +} - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/systemd/system - install ${WORKDIR}/systemd-udevd.service ${D}${sysconfdir}/systemd/system/systemd-udevd.service - sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/systemd/system/systemd-udevd.service - fi +pkg_postrm:${PN} () { + if [ -e $D${systemd_unitdir}/system/systemd-udevd.service ]; then + sed -i "/MountFlags=shared/d" $D${systemd_unitdir}/system/systemd-udevd.service + fi } -FILES:${PN} = "${sysconfdir}/udev ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${sysconfdir}/systemd/system/systemd-udevd.service', '', d)}" -RDEPENDS:${PN} = "udev util-linux-blkid" +RDEPENDS:${PN} = "udev util-linux-blkid ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'util-linux-lsblk', '', d)}" CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" # to replace udev-extra-rules from meta-oe
Signature · 1 line
2.25.1
PATCH 9/9 udev-extraconf:mount.sh: fix path mismatching issues
In reply to [email protected]From: Ming Liu <[email protected]>
Since commit f077befd5f36ad88623aaf6a38b1a837ecb18650:
[ udev-extraconf: let automount base directory configurable ]
the mount base directory was configurable, we need drop 'run-media' usage as well, change to figure it out from MOUNT_BASE.
Also 'get_label_name' function needs to be called ealier in automount_systemd before checking '/tmp/.automount-$name', otherwise they would never match.
(From OE-Core rev: c013b33162546fb5bd4bcc1daac75aa65d0be1a3)
--- meta/recipes-core/udev/udev-extraconf/mount.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
meta/recipes-core/udev/udev-extraconf/mount.sh +4 -4
@@ -40,11 +40,14 @@ automount_systemd() { name="`basename "$DEVNAME"`" # Skip already mounted partitions - if [ -f /run/systemd/transient/run-media-$name.mount ]; then + if [ -f /run/systemd/transient/$(echo $MOUNT_BASE | cut -d '/' -f 2- | sed 's#/#-#g')-*$name.mount ]; then logger "mount.sh/automount" "$MOUNT_BASE/$name already mounted" return fi + # Get the unique name for mount point + get_label_name "${DEVNAME}" + # Only go for auto-mounting when the device has been cleaned up in remove # or has not been identified yet if [ -e "/tmp/.automount-$name" ]; then
@@ -61,9 +64,6 @@ automount_systemd() { grep "^[[:space:]]*$tmp" /etc/fstab && return done - # Get the unique name for mount point - get_label_name "${DEVNAME}" - [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" MOUNT="$MOUNT -o silent"
Signature · 1 line
2.25.1