#!/bin/sh
########################################################################
# Begin $rc_base/init.d/paneld
#
# Description : Show Messages on the LCD Panel
#
# Author      : Jim Gifford - jim@linuxfromscratch.org
#
# Version     : 00.00
#
# Notes       :
#
########################################################################

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
	start)
		boot_mesg "Setting up LCD Panel"
		ip addr show dev eth0 > /dev/null 2>&1
		if [ "$?" = "0" ]; then
			IFACE1_IP="`ip addr show dev eth0 | grep inet | cut -d / -f 1 | cut -d t  -f 2 | cut -d' ' -f 2 `"
			IFACE1="$IFACE1_IP"
		fi
		ip addr show dev eth1 > /dev/null 2>&1
		if [ "$?" = "0" ]; then
			IFACE2_IP="`ip addr show dev eth1 | grep inet | cut -d / -f 1 | cut -d t  -f 2 | cut -d' ' -f 2 `"
			IFACE2="$IFACE2_IP"
		fi
		COMMON="Hold S & E Menu"
		if [ "$IFACE2" = "" ]; then
			loadproc paneld -d "Lan1 $IFACE1" "$COMMON"
		else
			loadproc paneld -d "Lan1 $IFACE1" "Lan2 $IFACE2" "$COMMON"
		fi

	;;

        stop)
                boot_mesg "Clearing LCD Panel..."
                putlcd "Clearing" "LCD Panel"
                killproc paneld
                ;;

        restart)
                ${0} stop
                sleep 1
                ${0} start
                ;;

        status)
                statusproc paneld
                ;;

	*)
		echo "Usage: {start|stop|restart|status}"
		exit 1
		;;
esac

# End $rc_base/init.d/paneld

