bahamas10/bash-vsv

Feature Request: Could this be defaulting to /etc/runit/runsvdir/default instead of /var/services?

madscientist42 opened this issue · 1 comments

A small introduction is in order to understand what I'm asking for here: I am one of the two mainline maintainers of an official fork of runit that lives on GitHub that is being used by at least ONE Fortune 500 company for the core of part of their products. I also maintain a Yocto metadata layer called meta-runit that allows one to readily and easily make runit be the default init and supervision system for a Yocto based embedded or other build of Linux. Introductons done, let's get to the explanation and full features request...

Path as-is is a symlink to that directory that gets generated by system scripting, which varies from distro to distro- whereas the given path in the description is consistent for EVERY distro as it's actually how runit currently works on any of them. The canonical path for the supervision metadata store is there- the others are based on what you specify or override that ultimately symlink back to the other.

For example, on a meta-runit based distribution, the path into /var for everything is /var/run/runit/runsvdir/current because I don't currently mess with how Gerrit did it in the original code and config there. But...the "directory" there is just a symlink to /etc/runit/runsvdir/default and it will always BE that as that's how runlevels are selected, etc.

This is a really nifty tool, all things being equal, and I'd rather not have to fork it to make it cleanly work for my distribution(s)- and the options there right now aren't clean, to be honest with you, for this sort of thing out of box at least for my case. The request to default it to the canonical path lets everyone pretty much use this out of box with the system current like you'd expect it to and then the other optioned mode can work for User usecases, etc. It will be included, regardless, with meta-runit shortly because like the blog says, it's really, really nice.

Hello! thank you for the request.

I'll make this change happily! I'm glad to see this tool is useful for you :). Question though, after researching this, which directory makes more sense for vsv to use:

  1. /etc/runit/runsvdir/current
  2. /etc/runit/runsvdir/default

I know your title says to use default, but I'm wondering if current makes more sense based on my understanding. I believe 99% of the time current will point to default, however I'm thinking it makes sense to use current so vsv can work by listing/modifying the "active" or "current" services... at least that's the intent by using current and not just assuming the default runlevel is current/active. Let me know what you think... either way I support this change.


long story for anyone interested

I dove into runit and looked up everything I could about it as well as OS specific changes. Void is interesting in how it does things. runsvdir is run like this on my machine:

$ pgrep -a runsvdir
949 runsvdir -P /run/runit/runsvdir/current log: ....snipped....
$ readlink /run/runit/runsvdir/current
/etc/runit/runsvdir/current

So it resolves to /etc/runit/runsvdir/current.

Looking at /var/service it does the same thing:

$ readlink /var/service
../run/runit/runsvdir/current
$ readlink /var/../run/runit/runsvdir/current
/etc/runit/runsvdir/current

This is also explained in the void handbook showing that /var/service is just meant to be a symlink to current.