From 63feeb9f369fc6176e85c1c2d8fcc863caad1946 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 10 Feb 2026 12:32:48 +0100 Subject: start new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- os/etc/s6-rc/src/net-online/shell-up | 62 ------------------------------------ 1 file changed, 62 deletions(-) delete mode 100755 os/etc/s6-rc/src/net-online/shell-up (limited to 'os/etc/s6-rc/src/net-online/shell-up') diff --git a/os/etc/s6-rc/src/net-online/shell-up b/os/etc/s6-rc/src/net-online/shell-up deleted file mode 100755 index b9fa779..0000000 --- a/os/etc/s6-rc/src/net-online/shell-up +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -set -eu - -# check if any interface is plugged in and configured -# then do a ping test to see if we have connectivity - -include_ping_test=1 -ping_test_host=gentoo.org -infinite=false -timeout=10 - -get_interfaces() -{ - local ifname iftype - for ifname in /sys/class/net/*; do - [ -h "${ifname}" ] || continue - read iftype < ${ifname}/type - [ "${iftype}" = "1" ] && printf "%s " ${ifname##*/} - done - return 0 -} - -check_interfaces() -{ - local ifcount=0 - local carriers=0 # plugged in - local configured=0 - for dev in $(get_interfaces); do - : $((ifcount += 1)) - read carrier < /sys/class/net/$dev/carrier 2>/dev/null || carrier="" - [ "${carrier}" = 1 ] && : $((carriers += 1)) - read operstate < /sys/class/net/$dev/operstate 2>/dev/null || operstate="" - [ "${operstate}" = up ] && : $((configured += 1)) - done - #[ $configured -eq $ifcount ] && [ $carriers -ge 1 ] && return 0 - [ $configured -ge 1 ] && [ $carriers -ge 1 ] && return 0 - return 1 -} - -check_online() -{ - local timeout=${timeout:-120} - while $infinite || [ $timeout -gt 0 ] ; do - check_interfaces && break - sleep 1 - : $((timeout -= 1)) - done - #echo 'plugged in' - - if [ "${include_ping_test}" = 1 ] && [ -n "${ping_test_host}" ]; then - local timeout=${timeout:-120} - while $infinite || [ $timeout -gt 0 ] ; do - ping -c 1 $ping_test_host >/dev/null 2>&1 - [ $? -eq 0 ] && break - sleep 1 - : $((timeout -= 1)) - done - fi - #echo 'connected' -} - -check_online -- cgit 1.4.1