On 08.04.21 15:15, Dewayne Geraghty wrote:
There is a cleaner solution. I prefer to set the init_path kernel env
var in /boot/loader.conf and prepend the s6 stage1 script to the normal
search path. That way the kernel starts my execline script as PID 1 and
if I mess it I just have to clear the variable from the loader prompt.
First we started with the documented approach of appending to /etc/ttys
"" "/usr/local/bin/s6-svscan /run/scan" "" on
Which worked nicely under FreeBSD's /sbin/init.
Then we added to loader.conf an init_script which is invoked via
/sbin/init. This also
worked well, but init remained as pid 1. The init_script variable is
defined in /boot/loader.conf, in my case as:
/sbin/init calls "init_script"
This ran nicely, but still under init as pid=1.
Finally I sucked up the courage and defined in /boot/loader.conf
redirfd -wnb 1 /m/fifo/catch_all
redirfd -r - /dev/null
fdmove -c 2 1
exec -c /sbin/s6/svscan -t 0 -s /s/scan
And finally /sbin/s6-svscan runs as pid 1.