Hey everybody!
For my own education, I wrote a script implementing some of
s6-linux-init's functionality:
| #!/usr/bin/execlineb
|
| export PATH /usr/bin/:/bin
|
| multisubstitute {
| define UMASK 0022
| define TMPFSDIR /run
| define BASEDIR /etc/s6-linux-init/current
| define RUNLEVEL default
| }
|
| foreground { echo s6-init }
|
| execline-cd /
| execline-umask ${UMASK}
|
| setsid
|
| redirfd -r 0 /dev/null
|
| foreground { fdclose 2 umount ${TMPFSDIR} }
|
| if { mount -t tmpfs -o mode=0755 tmpfs ${TMPFSDIR} }
|
| if { cp -Rf ${BASEDIR}/run-image/. ${TMPFSDIR}/ }
|
| s6-envdir ${BASEDIR}/env
|
| redirfd -w -nb 1 ${TMPFSDIR}/service/s6-svscan-log/fifo
|
| background {
| redirfd -w 2 ${TMPFSDIR}/service/s6-svscan-log/fifo
| ${BASEDIR}/scripts/rc.init ${RUNLEVEL}
| }
|
| redirfd -w -nb 2 ${TMPFSDIR}/service/s6-svscan-log/fifo
|
| s6-svscan ${TMPFSDIR}/service
As far as I understand, this mainly lacks the following things:
1. Reading the runlevel from the kernel command-line.
2. Trapping ctrl-alt-del.
3. Handling the environment and Kernel settings properly.
The script as above works on my s6-rc based system.
I am now wondering about a couple of points:
1. When I redirect the file descriptors 1 and 2 like above, I get, as
expected,
no output on console/tty during the boot process,
but I do get that when using s6-linux-init.
2. If I do not redirect them, I still get all the output on the catch
all logger.
3. Using the script as above, my /run/uncaught-logs seems to get
flooded with the same init messages over and over again during runtime.
Does anyone have solutions/explanations for the last three points?
What advantages (apart from the missing features) does s6-linux-init
have over this solution?
Regards
Paul
Received on Sat Nov 23 2024 - 00:24:01 CET