cvsdist 7b28834
#!/bin/bash
cvsdist 7b28834
#
prockai 468a0ae
# chkconfig: 234 85 15
cvsdist 7b28834
# description: GPM adds mouse support to text-based Linux applications such \
cvsdist c78d088
#              as the Midnight Commander. It also allows mouse-based console \
cvsdist 7b28834
#              cut-and-paste operations, and includes support for pop-up \
cvsdist 7b28834
#              menus on the console.
cvsdist 7b28834
# processname: gpm
cvsdist 7b28834
# pidfile: /var/run/gpm.pid
99f5665
# config: /etc/sysconfig/mouse
cvsdist 7b28834
cvsdist 7b28834
# source function library
cvsdist 7b28834
. /etc/init.d/functions
cvsdist 7b28834
Florian La Roche 08dcf69
if test -e /etc/sysconfig/mouse ; then
Florian La Roche 08dcf69
    . /etc/sysconfig/mouse
Florian La Roche 08dcf69
fi
cvsdist 7b28834
cvsdist 7b28834
RETVAL=0
cvsdist 7b28834
cvsdist 7b28834
start() {
cvsdist 84a7019
	echo -n $"Starting console mouse services: "
havill 68ec9e2
havill 68ec9e2
	if [ -z "$MOUSETYPE" ]; then
havill ef4815e
	    MOUSETYPE="exps2"
havill 68ec9e2
	fi
havill 68ec9e2
havill 68ec9e2
	if [ -z "$DEVICE" ]; then
havill 68ec9e2
	    DEVICE="/dev/input/mice"
cvsdist 7b28834
	fi
cvsdist 7b28834
cvsdist 7b28834
	if [ "$MOUSETYPE" = "none" ]; then
cvsdist 84a7019
		echo $"(no mouse is configured)"
cvsdist 7b28834
		exit 0
cvsdist 7b28834
	fi
cvsdist 7b28834
cvsdist 7b28834
	if [ "$MOUSETYPE" = "Microsoft" ]; then
cvsdist 7b28834
		MOUSETYPE=ms
cvsdist 7b28834
	fi
cvsdist 7b28834
cvsdist f476c1f
	if [ -n "$IMOUSETYPE" ]; then
havill 1959126
                if [ "$(pidofproc inputattach)" = "" ]; then
havill 1959126
			modprobe sermouse > /dev/null 2>&1
havill 1959126
			/usr/sbin/inputattach -$IMOUSETYPE $DEVICE --daemon
havill 1959126
			DEVICE="/dev/input/mice"
havill 1959126
			MOUSETYPE="exps2"
havill 1959126
		fi
cvsdist f476c1f
        fi
cvsdist 84a7019
cvsdist 7b28834
	if [ -n "$MOUSETYPE" ]; then
cvsdist f476c1f
		daemon gpm -m $DEVICE -t $MOUSETYPE $OPTIONS
cvsdist 7b28834
	else
cvsdist f476c1f
		daemon gpm -m $DEVICE $OPTIONS
cvsdist 7b28834
	fi
cvsdist 7b28834
	RETVAL=$?
cvsdist 7b28834
	echo
cvsdist 7b28834
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/gpm
cvsdist 7b28834
}
cvsdist 7b28834
cvsdist 7b28834
stop() {
cvsdist 84a7019
	echo -n $"Shutting down console mouse services: "
cvsdist 7b28834
	killproc gpm
havill 1959126
	if [ -n "$IMOUSETYPE" ]; then
havill 1959126
		killproc inputattach
havill 1959126
	fi
cvsdist 7b28834
	RETVAL=$?
cvsdist 7b28834
cvsdist 7b28834
	echo
cvsdist 7b28834
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/gpm
cvsdist 7b28834
}
cvsdist 7b28834
cvsdist 7b28834
case "$1" in
cvsdist 7b28834
  start)
cvsdist 7b28834
	start
cvsdist 7b28834
	;;
cvsdist 7b28834
  stop)
cvsdist 7b28834
	stop
cvsdist 7b28834
	;;
cvsdist 7b28834
  restart|reload)
cvsdist 7b28834
	stop
cvsdist 7b28834
	start
cvsdist 7b28834
	;;
cvsdist 7b28834
  condrestart)
cvsdist 7b28834
	if [ -f /var/lock/subsys/gpm ]; then
cvsdist 7b28834
	    stop
cvsdist 7b28834
	    start
cvsdist 7b28834
	fi
cvsdist 7b28834
	;;
cvsdist 7b28834
  status)
cvsdist 7b28834
	status gpm
cvsdist 7b28834
	RETVAL=$?
cvsdist 7b28834
	;;
cvsdist 7b28834
  *)
cvsdist 84a7019
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
cvsdist 7b28834
	exit 1
cvsdist 7b28834
esac
cvsdist 7b28834
cvsdist 7b28834
exit $RETVAL