#!/bin/bash
# Begin $rc_base/init.d/gpm

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
# GPM specific parts by Mark Hymers - markh@linuxfromscratch.org

#$LastChangedBy: dnicholson $
#$Date: 2006-10-11 02:42:17 -0500 (Wed, 11 Oct 2006) $

. /etc/sysconfig/rc
. $rc_functions

pidfile=/run/gpm.pid

if [ -f /etc/sysconfig/mouse ]
	then
	. /etc/sysconfig/mouse
fi

if [ -z "$MDEVICE" ] || [ -z "$PROTOCOL" ]
	then
	echo "Please create an /etc/sysconfig/mouse file containing"
	echo "MDEVICE and PROTOCOL values"
	exit 1;
fi

case "$1" in
	start)
		boot_mesg "Starting gpm..."
		loadproc -p $pidfile /usr/sbin/gpm -m $MDEVICE -t $PROTOCOL $GPMOPTS
		;;

	stop)
		boot_mesg "Stopping gpm..."
		killproc -p $pidfile /usr/sbin/gpm
		;;

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

	status)
		statusproc -p $pidfile /usr/sbin/gpm
		;;

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

# End $rc_base/init.d/gpm
