From: Stefano Babic <[email protected]>

Detecting the init manager from /sbin/init does not always work and it
fails when etc-overlayfs is used, because first the
pre-init script is called and init is renamed as init.orig.. Read the
process name with pid = 1 from /proc, and use it to detect the init manager.

Signed-off-by: Stefano Babic <[email protected]>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 4827779e2f..3ddee84b78 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,7 +4,8 @@
 #
 # Attempt to mount any added block devices and umount any removed devices
 
-BASE_INIT="`readlink -f "@base_sbindir@/init"`"
+INITNAME=`cat /proc/1/cmdline`
+BASE_INIT="`readlink -f ${INITNAME}`"
 INIT_SYSTEMD="@systemd_unitdir@/systemd"
 MOUNT_BASE="@MOUNT_BASE@"
 
@@ -165,7 +166,7 @@ automount() {
                echo "$name" > "/tmp/.automount-$name"
        fi
 }
-       
+
 rm_dir() {
        # We do not want to rm -r populated directories
        if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#233107): 
https://lists.openembedded.org/g/openembedded-core/message/233107
Mute This Topic: https://lists.openembedded.org/mt/118327134/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to