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 <[email protected]>
---
 .../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..ead4dba46d 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" ] && [ "$(readlink -- "/sbin/init")" = 
"/sbin/init.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 (#145831): 
https://lists.openembedded.org/g/openembedded-core/message/145831
Mute This Topic: https://lists.openembedded.org/mt/79049550/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to