#! /bin/sh
#
# This version of the configuration file is only suitable for
# the m680x0 series of machines. In these cases, the configuration
# process is unnecessary, but it may still be useful to output
# information about the serial configuration
#    Gordon Russell <g.russell@dcs.napier.ac.uk>
#
SETSERIAL=/bin/setserial

# if the setserial executable is unavailable then abort the configuration
[ -x ${SETSERIAL} ] || exit 0

#
# Handle System V init conventions...
#
case $1 in
start | restart | force-reload )
	action="start";
	;;
stop | modload | modsave )
	action="stop";
	;;
*)
	action="start";
esac

if test $action  = stop ; then
	exit 0
fi

#
# If not stop, it must be a start....
#

insmod -k serial 2>/dev/null

ALLDEVS="/dev/ttyS?"
if /bin/ls /dev/ttyS?? 2> /dev/null ; then
	ALLDEVS="$ALLDEVS /dev/ttyS??"
fi

rtn=`${SETSERIAL} -bg ${ALLDEVS} >/dev/null 2>&1`
if [ $? -gt 0 ]
then
  echo "Aborting serial port reporting. Check the serial modules..."
  exit 1
fi

${SETSERIAL} -bg ${ALLDEVS}
#
