Control: tags -1 +patch

initial version of the service is here
(loopback probably is not useful)

$ cat /etc/sv/network-is-up/run 
#!/bin/sh
#Copyright: 2025 Lorenzo Puliti <[email protected]>
#                  2025 Andrew Bower <[email protected]>
#License: CC0-1.0

exec chpst -L /run/runit/${PWD##*/}.lock chpst -l \
   /run/runit/${PWD##*/}.lock true 
-----------------------------------------------------

$ cat /etc/sv/network-is-up/check
#!/bin/sh

if [ -x /usr/sbin/ip ]; then
        for interf in $(ip addr | grep -Po '^\d+:\s+\K[^:]+') ; do
                [ "$interf" = 'Iface' ] && continue
                [ "$interf" = 'lo' ] && continue
                echo "$interf" | grep docker >/dev/null && continue
                echo "$interf" | grep incusbr >/dev/null && continue
                echo "$interf" | grep lxcbr >/dev/null && continue
                ip link show enp0s31f6 | grep 'UP' >/dev/null && exit 0
#               if [ -x /usr/sbin/iwconfig ]; then ...
        done
        exit 1
elif [ -x /usr/sbin/ifconfig ]; then
        for interf in $(ifconfig -s | cut -f1 -d' ') ; do
                [ "$interf" = 'Iface' ] && continue
                [ "$interf" = 'lo' ] && continue
                echo "$interf" | grep docker >/dev/null && continue
                echo "$interf" | grep incusbr >/dev/null && continue
                echo "$interf" | grep lxcbr >/dev/null && continue
                ifconfig "$interf" |grep 'inet' >/dev/null && exit 0
#               if [ -x /usr/sbin/iwconfig ]; then ...
        done
        exit 1
else
        #no tools to detect, fail the check
        exit 1
fi
----------------------------------

$ cat /etc/sv/network-is-up/finish 
#!/bin/sh

chpst -l /run/runit/network-is-up.lock rm /run/runit/network-is-up.lock
-----------------------------

yes the check file can be improved, however this one should be fine for
testing

Lorenzo

On Mon, 13 Oct 2025 14:11:55 +0200 Lorenzo Puliti
<[email protected]> wrote:
> Package: runit-services
> Version: 0.9.1
> Severity: important
> X-Debbugs-Cc: Andrew Bower <[email protected]>, [email protected]
> 
> (adding Andrew in CC since he sent the MRs that are blocked)
> 
> There are two MR on Salsa
> gerbera
> https://salsa.debian.org/debian/runit-services/-/merge_requests/4
> xl2tpd
> https://salsa.debian.org/debian/runit-services/-/merge_requests/9
> 
> that are blocked because we are not able to test for network:
> the proper solution is to add oneshot capability to runit package,
> but this requires some design and I'm not sure it will be ready
> before forky, and blocked MR are already 1 year old.
> 
> In order to unblock MRs in a reasonable time frame I propose to
> termporarily add two standard services (to be replaced by oneshots in
> future) to test network in the check file and wait forever in the run
> file.
> 
> I think those services should meet the following conditions:
> 
> * name should not match any existing sysv script to avoid the
> shadowing logic that runs at startup and during runtime; name could
> be 'loopback-is-up' and 'network-is-up'
> 
> * script are only for testing the network, they do not bring the
> network up in stage 2.
> 
> * they shuould work in non-linux port, so if 'ip' is used but is
>   not available in the platform, fallback on ifconfig
> 
> 
> 'loopback-is-up' and 'network-is-up'
> 
> I'll send some draft here as soon as I have something.
> 
> Lorenzo
> 
> 
> -- System Information:
> Debian Release: forky/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 6.8.12-amd64 (SMP w/4 CPU threads; PREEMPT)
> Kernel taint flags: TAINT_FIRMWARE_WORKAROUND, TAINT_OOT_MODULE,
> TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8
> (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to
> /usr/bin/dash Init: runit (via /run/runit.stopit)
> 
> Versions of packages runit-services depends on:
> ii  runit         2.2.0-6
> ii  runit-helper  2.16.4
> 
> Versions of packages runit-services recommends:
> ii  runit-init  2.2.0-6

Reply via email to