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

(From OE-Core rev: 15c467d0206ee30fe708f76b7d5e0033ab687475)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2020-12-18 18:23:42 -08:00
committed by Richard Purdie
parent 5cb971b4fd
commit 8736019681

View File

@@ -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