#!/bin/bash

loud() {
  local msg="$1"
  echo -e "$msg" > /dev/ttyS0
  echo -e "$msg" > /dev/tty1
  echo -e "$msg" | logger -t ip-out
}

ips() {
  ip-out | jq -r '.[] | select((.addresses | length)>0)'
}

until [ "$(ips)" != "" ]; do
  sleep 2
done

loud "------- Detected Network Interfaces -------"
loud "$(ip-out -pp)"
loud "-------------------------------------------"
