> sysvinit works similarly, with /lib/sysvinit/init
This was in Jessie, but I don't see any /lib/sysvinit/init in Stretch nor in Sid,
it's /sbin/init now, am I wrong?
Dmitry Bogatov wrote:
>I propose to replace current approach with update-alternatives(1)
>approach. By coordinated effort of present init systems (in thread), we
>introduce master link /sbin/init and number of slave links:
>
> /sbin/halt
> /sbin/poweroff
> ....
A slightly different approach is also possible:
Ship only /sbin/init as a alternative link ("the default init" as user choice)
and ship in `init-system-helpers' the following
/sbin/halt
/sbin/poweroff
/sbin/reboot
/sbin/runlevel
/sbin/shutdown
as programs that check for the current running init and
then execute the proper command. For example
/sbin/reboot
#!/bin/sh
# systemd
if [ -d /run/systemd/system ]; then
exec /bin/systemctl reboot
fi
#sysv
if [ -p /run/initctl ]; then
exec /sbin/sysv-reboot
fi
#runit
if [ -e /run/runit.stopit ]; then
exec /sbin/runit-init 6
fi
#openrc
#if [ test for openrc ]
# exec 'openrc code for reboot'
# fi
Of course this require that each init rename it's /sbin/reboot
into something else: systemd already comply, sysv and runit
require some change, and I don't know about Openrc.