#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

TSPATH="/thickscripts"

case "$1" in
  start)

    stat_busy "Starting ThickScripts"
    echo "ThickScripts: loadings system settings for all hosts"
    $TSPATH/all
    echo "done"
    echo
    IP=`ip a s eth0 | grep -m 1 "inet " | cut -d " " -f 6 | cut -d / -f 1`
    if [ -f $TSPATH/$IP ]; then
     echo "ThickScripts: loading system settings for $IP"
     $TSPATH/$IP
    else
     echo "ThickScripts: system settings for $IP not found, using defaults"
     $TSPATH/default
    fi
    echo "done"
    stat_done
    ;;
  stop)
    stat_busy "Stopping ThickScripts"
    echo "Nothing to stopping..."
    stat_done
    ;;
  *)
    echo "usage: $0 {start|stop}"
esac

exit 0