summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-network/scripts/setup-bootif-network.stage3
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/slx-network/scripts/setup-bootif-network.stage3')
-rwxr-xr-xmodules.d/slx-network/scripts/setup-bootif-network.stage333
1 files changed, 29 insertions, 4 deletions
diff --git a/modules.d/slx-network/scripts/setup-bootif-network.stage3 b/modules.d/slx-network/scripts/setup-bootif-network.stage3
index 74d1c2b5..024ac0cf 100755
--- a/modules.d/slx-network/scripts/setup-bootif-network.stage3
+++ b/modules.d/slx-network/scripts/setup-bootif-network.stage3
@@ -10,20 +10,45 @@ type emergency_shell >/dev/null 2>&1 || . /lib/dracut-lib.sh
. /run/openslx/network.conf
-# guard to not run until the phsyical interface is not ready yet
+# do not run until the physical interface is not ready yet
if [ ! -e "/sys/class/net/${SLX_PXE_NETIF}/device" ]; then
exit 1
fi
+# wrapper around splashtool to disable it if its not present
+_splashtool() {
+ :
+}
+if [ -x "/opt/openslx/bin/splashtool" ]; then
+ _splashtool() {
+ /opt/openslx/bin/splashtool "$@"
+ }
+fi
+
wait_for_iface() {
local _iface="$1"
local _timeout="${2:-50}"
+ if [ "$_iface" = "$SLX_PXE_NETIF" ]; then
+ img="??-nic"
+ elif [ "$_iface" = "$SLX_BRIDGE" ]; then
+ img="??-bridge"
+ fi
while [ "$_timeout" -ne 0 ]; do
[ "$(cat /sys/class/net/${_iface}/operstate)" = "up" ] && break
(( _timeout -- ))
- usleep 100000
+ # every 500ms
+ usleep 500000
+ in=
+ [ "$(( _timeout % 2 ))" = 0 ] && in=in
+ _splashtool --icon "/opt/openslx/icons/${in}active/${img}.ppm" &
done
- [ "$_timeout" -ne 0 ]
+ if [ "$_timeout" -ne 0 ]; then
+ _splashtool --icon "/opt/openslx/icons/active/${img}.ppm" &
+ return 0
+ else
+ _splashtool --icon "/opt/openslx/icons/inactive/${img}.ppm" &
+ return 1
+ fi
}
# For debugging...
@@ -31,7 +56,7 @@ wait_for_iface() {
set -x
ip link set dev "$SLX_PXE_NETIF" up
-if ! wait_for_iface "$SLX_PXE_NETIF" 300; then
+if ! wait_for_iface "$SLX_PXE_NETIF" 60; then
warn "'$SLX_PXE_NETIF' still not up after 30sec ... trying anyway."
# TODO handle case where we waited for 30sec and it is still not up
fi