Check if init system is sysvinit to recreate initctl, this ensures that
it can be used with busybox init system as well

Signed-off-by: Khem Raj <raj.k...@gmail.com>
Cc: Sinan Kaya <ok...@kernel.org>
---
v2: Use INIT_SYSTEM to identify init system

 .../initscripts/initscripts-1.0/mountall.sh   | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh 
b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
index c719be5d9a..2839d57cbe 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
@@ -19,15 +19,21 @@
 test "$VERBOSE" != no && echo "Mounting local filesystems..."
 mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
 
-#
-# We might have mounted something over /dev, see if /dev/initctl is there.
-#
-if test ! -p /dev/initctl
-then
-       rm -f /dev/initctl
-       mknod -m 600 /dev/initctl p
+
+# We might have mounted something over /run; see if
+# /dev/initctl is present.  Look for
+# /sbin/init.sysvinit to verify that sysvinit (and
+# not busybox or systemd) is installed as default init).
+INITCTL="/dev/initctl"
+if [ ! -p "$INITCTL" ] && [ "${INIT_SYSTEM}" = "sysvinit" ]; then
+    # Create new control channel
+               rm -f "$INITCTL"
+               mknod -m 600 "$INITCTL" p
+
+               # Reopen control channel.
+               PID="$(pidof -s /sbin/init || echo 1)"
+               [ -n "$PID" ] && kill -s USR1 "$PID"
 fi
-kill -USR1 1
 
 #
 # Execute swapon command again, in case we want to swap to
-- 
2.29.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#145877): 
https://lists.openembedded.org/g/openembedded-core/message/145877
Mute This Topic: https://lists.openembedded.org/mt/79076455/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to