Hi Andrew,

thanks for your comprehensive reply

On Thu, 16 Oct 2025 22:54:59 +0100 Andrew Bower <[email protected]> wrote:
> Hi Lorenzo,
> 
> On Wed, Oct 15, 2025 at 03:36:22PM +0200, Lorenzo wrote:
> > Control: tags -1 +patch
> > 
> > initial version of the service is here
> 
> Thanks for adding this support to unblock my service directory
> contributions!
> 
> I don't see a problem in principle with using a new service directory
> as a dependency for services that require networking, but I think
> there's a better way to the extent that I think we should not do a
> service directory.
> 
> Let's remember that there is nothing philosophical or practical about
> runit that means a service directory's dependency needs to be another
> service, rather than another type of check that can be performed.

yeah, I agree except the advantage of using a service is that sv check
waits up to x seconds before giving up. I want to implement this for
oneshots checks, without a runit service I'll have to implement this
too.

> 
> [snip]
> 
> In my contributed service definitions I have entirely omitted network
> checks that are not needed at all, even if $network was present in the
> initscript. Instead, I have found out what the real underlying
> requirement is and implemented that as minimally as possible.

I'm aware checks that are in the MR are more accurate, but I hoped that
a less accurate and more generic check could be used: I see that
probably this idea does not work.

> [snip]
> 
> So how can we do this generally?
> [snip]

> I think the answer is to have a library of shell functions we can call
> to check things. You could put this in invoke-run but I wonder if that
> is getting a bit full. So maybe another file, either sourced from
> invoke-run or directly from the run script.
>
> Something like:
>
> #...
>
> . /lib/runit/network-checks
> 
> have_network_address scope=global family=inet || exit 1
> 
> #...

ok I'm going to try this, but I have few questions:

* why map scope= to a number, if I can filter for the word? do we need
  to filter for something within each scope (and it can be done with
  the numeric mapping)?

* what to do if scope= and or family= are not passed to the command?
  just fail or have some default for both?

* what if ip (and or ifconfig) are not found in the system? is it safe
  to assume that network is not configured and fail in this case?

Best,
Lorenzo

Reply via email to