Bug 237760 - sysutils/s6-rc: Allow overriding livedir
Summary: sysutils/s6-rc: Allow overriding livedir
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
Keywords: needs-patch, needs-qa
Depends on:
Reported: 2019-05-06 02:00 UTC by dewayne
Modified: 2020-05-01 14:22 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (moo)


Note You need to log in before you can comment on or make changes to this bug.
Description dewayne 2019-05-06 02:00:19 UTC
Would it be possible to add a variable to the Makefile that enables customisation of s6-rc's root. I have different location of memory disks and would prefer to pass a variable during build rather than have to create a soft-link to /run/s6-rc.

Perhaps something like:

--- /usr/ports/sysutils/s6-rc/Makefile  (revision 500571)
+++ /usr/ports/sysutils/s6-rc/Makefile  (working copy)
@@ -21,6 +21,8 @@
 LIB_DEPENDS=   libs6.so:sysutils/s6 \

 USES=          gmake

@@ -31,6 +33,7 @@
        --with-lib=${LOCALBASE}/lib/execline \
        --with-lib=${LOCALBASE}/lib/s6 \
        --with-dynlib=${LOCALBASE}/lib \
+       --livedir=${LIVEDIR} \


And thanks for maintaining the port, I found s6 & friends and decided to use it  before realising that it was already available in "ports".  A nice surprise :)
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-05-06 02:06:07 UTC
@Dewayne Could you include your proposed change as an attachment please.

Also, what does the livedir default to, if not specified at buildtime? If it doesn't default to it already, it should probably be default to "/var/run"

Does the software have a configuration file? Is a sample configuration provided by the port/package? If so, complementary changes should be added there too, setting the default location to match the build-time path
Comment 2 dewayne 2019-05-06 08:43:17 UTC
(In reply to Kubilay Kocak from comment #1)
Unfortunately the samba jail is having some problems, so I'm unable to access the diff file.  If it was more than two lines...

The default can be overridden at build time, or tediously at each command invocation.  The "livedir" is stated as /run/s6-rc in the documentation, refer http://www.skarnet.org/software/s6-rc/s6-rc-db.html

I like your integrative thinking, but unfortunately there is no configuration file, and hence no sample config.  The port performs a function akin to openrc - in that you define what the system/server is going to do.  This provides a reasonable explanation

Alas, even with excellent documentation it is a steep learning curve, where examples would be highly beneficial.
Comment 3 dewayne 2019-05-06 09:19:57 UTC
(In reply to Kubilay Kocak from comment #1)
Oops - I missed a question.

Defaulting to /var/run wouldn't be the best idea.  As the s6-rc system requires four directory trees to function ( source files; compiledir; livedir; scandir), comprising:
1. Your source files, I've placed mine in /usr/local/etc/s6 
2. A target directory for the "compiled" source files is created (as an argument to the s6-rc-compile program).  Compiled in the sense that the source files are scanned for things like application dependencies, bundles of applications, etc, and the supporting "scandirectory" describes this architecture.
3. Upon initialisation, the compiled tree is copied to the "livedir" where setting some configuration files (essentially saying applications are down ie "not started")
4. The essence of service management is performed by the s6 port which manages the service supervisors via the final "scandir" - its essentially a bunch of softlinks to livedir.  

Once this is done, the serivces are managed by signal interrupts and its actually a lot of fun.  The buik of the work is in constructing the scripts to run and finish or crash things. 

So putting this into /var/run may not be the best, /var/db may be better but I took the approach of creating a  mfs (from fstab) rw,noatime,async,-s10m,-b8192,-f2048,-S,-n where I place the compiledir, livedir and scandir.  Which works very well, there are many small files here (and may be frequently accessed).

The one change to the s6-rc/Makefile that I'd suggest is to use /usr/local/etc/s6 as the FreeBSD way of storing what are essentially config files that describe how to run/finish/contents/type/...  things to the system.  Unfortunately there is no configuration option in the s6-rc distribution, so creating such a directory could be included in the Makefile.

I hope that this helps.
Comment 4 crest 2020-04-17 12:15:08 UTC
You can pass the live directory on the command line unless some wrapper script doesn't allow you to pass `-l $live_dir` to s6-rc there is not need to use (or change) the default live directory except ease of use on the shell. If any scripts are lacking a way to pass the live directory path through those scripts should be improved.
Comment 5 dewayne 2020-04-17 12:26:37 UTC
(In reply to crest from comment #4)
Sure.  But its more about the tedium of needing to be explicit to s6-rc everytime  that it is interacted with.  It is a lot more efficient making use of a 
LIVEDIR?= whatever
in the build, then to enter it "-l whatever" for every command.
Comment 6 crest 2020-05-01 14:22:46 UTC
I took over as maintainer of s6-rc and see no problem adding the feature you requested. Please attach a patch for me to review to this PR.