From 15c467d0206ee30fe708f76b7d5e0033ab687475 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 18 Dec 2020 18:23:42 -0800 Subject: initscripts: Use initctl on sysvinit only 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 Cc: Sinan Kaya Signed-off-by: Richard Purdie --- .../initscripts/initscripts-1.0/mountall.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'meta/recipes-core') 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 -- cgit 1.2.3-korg