]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
initscripts: Use initctl on sysvinit only
authorKhem Raj <raj.khem@gmail.com>
Sat, 19 Dec 2020 02:23:42 +0000 (18:23 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 20 Dec 2020 00:03:01 +0000 (00:03 +0000)
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.khem@gmail.com>
Cc: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh

index c719be5d9ac021aa15d69f78cb1d33af8f905f18..2839d57cbec5093f1a0fc72736d2a7054385ec74 100755 (executable)
 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