:: [Dng] Suckless init and friends
Góra strony
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Dla: dng
Temat: [Dng] Suckless init and friends
Hi all,

This email isn't a recommendation for the Devuan distribution, it's
just some interesting info for the more DIY members of the Devuan
community...

Consider the following:

* Suckless init: http://git.suckless.org/sinit

* Suckless svc: http://core.suckless.org/svc

* Suckless portable utils (sbase): http://core.suckless.org/sbase

* Suckless nonportable utils (ubase): http://core.suckless.org/ubase

The init program does initialization with no process management. It
passes control to rc.whatever. In that respect, it doesn't conform to
Laurent's minimum of supervising at least one process, but rc.whatever
can exec to something that manages all processes, so you have only that
one tiny process at risk.

The ubase utilities include something called "respawn", which
apparently manages a process via fifo
(http://git.suckless.org/ubase/tree/respawn.c). They have some
shellscripts in the svc svc-master group, which appear to make for very
simple init scripts.

=== MY PLANS ===

So what I'm going to do, when I get the time, is init a Linux box with
Suckless init (http://git.suckless.org/sinit/tree/sinit.c), and have it
transfer control to rc.whatever, which will be a tiny script using
respawn to run all the rest of the process management, using respawn
for early stuff, and daemontools or daemontools-encore for the rest.

I've already done a proof of concept, I can init to /bin/bash using
Suckless Init, and when I send the proper SIGUSR1, SIGCHLD, or SIGINT
to PID1, it runs rc.shutdown with the expected arguments. Here's an
example rc.shutdown: http://git.2f30.org/ports/tree/fs/bin/rc.shutdown

The result will be very close to an init system as defined by Laurent:
The only unmanaged process will be rc.whatever, and that will be a tiny
script unlikely to abort by itself.

If I *really* get into it, I think there might be a possibility of
mixing the code of sinit.c with the code of respawn.c, to produce an
init that *supervises* rc.whatever instead of just running it, with
rc.whatever supervising and sub-supervising all the rest. What would
make this challenging is that respawn.c
(http://git.suckless.org/ubase/tree/respawn.c) depends on a fifo, and
this might be before the root filesystem is mounted.

Like I said before, I'm not advocating that Devuan put in any hooks or
packages for this stuff, I'm just commenting on what's available for
experimentation.

SteveT

Steve Litt
May 2015 featured book: Quit Joblessness: Start Your Own Business
http://www.troubleshooters.com/startbiz