Hi Alexis, and everyone else,
i guess i'd probably want OpenRC supervising the user s6-svscan process, mainly because, at this point, i'd like to keep using OpenRC on my Gentoo system overall: since a lot of my volunteer tech work involves providing support to others and writing/maintaining documentation, it's useful to keep my own system fundamentally similar to what others are running.
I realized I have here just what you need, or at least could use, to do that: an OpenRC service definition and an execline script which execs into s6-svscan and sets up s6-rc on top of it.
The execline script is a bit hacky (this loopwhilex should be replaced by a proper tool waiting for s6-svscan readiness notification), so if anyone wants to propose enhancements I’m all hears.
The OpenRC script is specifically written for my user, I guess you could make it generic, I didn’t bother to do so. Feel free to adapt. The xdg-runtime-dir-bezier-h service referenced in depend() is a service which makes sure my user has an existing XDG_RUNTIME_DIR at startup (it usually is created on login, but I want my services to be run during the boot sequence).
Both the execline script and the OpenRC service are based on Laurent’s s6-svscan OpenRC service for Alpine Linux in which he claims that in the future s6-svscan will be pid1 in Alpine. ;)
Enjoy, Hoël
#!/bin/execlineb -S1 emptyenv -p export USER ${1} s6-envuidgid -i -- ${1} s6-applyuidgid -U -- backtick -in HOME { homeof ${1} } multisubstitute { importas -i USER USER importas -i HOME HOME importas -i UID UID importas -i GID GID importas -i GIDLIST GIDLIST } export PATH "/usr/bin:/usr/sbin:/bin:/sbin" if { install -d -o ${1} -g ${1} -m 0700 /run/${1}/services } background { foreground { loopwhilex -x 0 s6-rc-init -c ${HOME}/.config/s6-rc/compiled -l /run/${1}/s6-rc -d /run/${1}/services } s6-rc -l /run/${1}/s6-rc -u change default } redirfd -r 0 /dev/null s6-svscan -- /run/${1}/services
#!/sbin/openrc-run depend() { after xdg-runtime-dir-bezier-h } name="s6" command="/lib/s6/s6-usertree" command_args="bezier-h" pidfile="/run/s6-bezier-h.pid" start_stop_daemon_args="-b -m -k 022"
signature.asc
Description: PGP signature