#!/bin/bash

TIMEOUT=10
DEV=eth0

echo 3 > /proc/sys/kernel/printk

cnt=0
echo waiting for IP
while (( $cnt < $TIMEOUT )); do
    IP=$(/usr/sbin/ip -4 addr show dev $DEV scope global | grep "inet"  | cut -f6 -d' ' | cut -f1 -d'/' )
    [[ $IP ]] && break
    sleep 1;
    (( cnt++ ))
    IP="Unknown"
done

/usr/bin/chvt 1
/usr/bin/setterm -powersave off -blank 0
/usr/bin/clear

# This sets the font colour
if [ -e /etc/sysconfig/splashfontcol ]; then
   # put 2 echo commands in here to customise as vendor
   . /etc/sysconfig/splashfontcol
else
# last 6 digits of the echos are RRGGBB
  /bin/echo -en '\033]P7B1BFDB' # fg
  /bin/echo -en '\033]P0011130' # bg
fi

/usr/bin/tput cup 25 0
/usr/bin/ply-image

cat /etc/sdk-welcome-message

/usr/libexec/sdk-setup/workspace-autodetect --dry-run \
    |& sed 's/^/  /' # same indent as the welcome message

/bin/echo -en '\033]R'
