Skip to contentSkip to conversation

udev-extraconf: detect init manager from pid

PATCH New [email protected] 1 participant 1 message Mar 15

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udev-extraconf: detect init manager from pid

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.

---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/udev/udev-extraconf/mount.sh +3 -2
index 4827779e2f..3ddee84b78 100644
@@ -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"
Signature · 1 line
2.43.0