On Sat, Oct 18, 2025 at 01:58:35AM +0200, Lorenzo wrote:
 On Fri, 17 Oct 2025 23:16:23 +0100
> Andrew Bower <[email protected]> wrote:
[...]
 
> > > * 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?
> > 
> > That's a good question. Needs further thought. Might be worth noting
> > we're probably doing more than the initscripts would here - they would
> > just wait until networkmanager/dhclient/networking or whatever
> > services have been started and possibly failed. So maybe we're over
> > thinking this and actually need to wait on default-network instead
> > which can launch those like default-rsyslog does. But I think it
> > would be ugly to have a service launch another service to do this -
> > is there a way of having an alias for whichever network setup service
> > is configured
> 
> default-syslog is a first attempt, and I'm not happy about it.
> I don't find attractive to play with symlinks and alternatives either..
> 
> Recently I was thinking:
> * define a facility "suffix" in runit; for example '-log' for sysloggers
>   (could be '-net' for network)
> * rename all services that belong to the group appending the common
>   '-log' suffix to the end of the service name. For example rsyslog-log,
>   socklog-unix-log and so on
> * in run files of services that require one service of the '-log' group
>   check the service with full path and wildcards, for example
>   'sv check /etc/service/*-log'
> but I still have to test if it works as expected..

Leaving aside my talk about ip address checks for the moment, your
wildcard suggestion got me thinking.

This seems like a better idea than forcing services to be named a
certain way:

Any service that wants to provide an LSB-style 'facility' could have an
empty file in its service directory called 'provides-<facility>'. I
have mocked this up like this (and remember ifupdown is down in stage 1):

=== /usr/lib/runit/facilities ===

facility() {
  for i in $(find "$SVDIR" -iregex "[^.]*/provides-$1" -printf "%h ")
  do
    basename $i
  done
}

sv_if() {
  [ $# -gt 1 ] || return
  sv "$@"
}


=== /usr/share/runit/sv.src/network-manager/provides-network ===


=== /usr/share/runit/sv.src/dhclient/provides-network ===


=== /usr/share/runit/sv.src/gerbera/run ===

#!/usr/bin/env /lib/runit/invoke-run

exec 2>&1

. /usr/lib/runit/facilities

sv_if start $(facility network) || exit 1

exec chpst -u gerbera:gerbera ##bin## -c /etc/gerbera/config.xml

Reply via email to