Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > 532be3690260976424c85fef6433033e > files > 10

mouseemu-0.15-2mdv2007.0.src.rpm

#!/bin/sh
#
# mouseemu	Mouse emulation daemon
#
# chkconfig: 2345 60 62
# description:	mouseemu is a daemon which emulates mouse
#
# config:	/etc/sysconfig/mouseemu
#
### BEGIN INIT INFO
# Provides: mouseemu
# Required-Start: $syslog
# Should-Start: harddrake
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Short-Description: A daemon that can emulate your mousebuttons on a keyboard
# Description: Mouseemu uses inputhandlers to create a virtual mouse \
#		device that emulates mouse buttons on your keyboard. \
#		It can be very useful for using One-button mice with linux.
### END INIT INFO

# Source function library
. /etc/rc.d/init.d/functions

# Get service config
if [ -f /etc/sysconfig/mouseemu ]; then
	. /etc/sysconfig/mouseemu
fi

RETVAL=0
# See how we were called.
case "$1" in
  start)
	# Check if service is already running
	if [ ! -f /var/lock/subsys/mouseemu ]; then
		if (! (export LC_ALL=C; /sbin/lsmod | /bin/egrep "^evdev +" > /dev/null 2>&1)); then
		       modprobe evdev > /dev/null 2>&1;	
		fi
		if (! (export LC_ALL=C; /sbin/lsmod | /bin/egrep "^uinput +" > /dev/null 2>&1)); then
			modprobe uinput > /dev/null 2>&1;
		fi
		gprintf "Starting mouseemu"
		daemon mouseemu $MOUSEEMU_OPT
		RETVAL=$?
		echo

		# We need to restart services that use inputhandlers:(
		[ -f /var/lock/subsys/pbbuttonsd ] && gprintf "Manual pbbuttonsd restart\n"
		[ -f /var/lock/subsys/pbbuttonsd ] && service pbbuttonsd restart
		
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mouseemu
	else
		gprintf "Service mouseemu is already running\n"
	fi
	;;
  stop)
	if [ -f /var/lock/subsys/mouseemu ]; then
		gprintf "Stopping mouseemu"
		killproc mouseemu
		rm -f /var/lock/subsys/mouseemu
		echo
	else
		gprintf "Service mouseemu is not running\n"
	fi
	;;
  status)
	status mouseemu
	exit $?
	;;
  restart|reload)
	$0 stop
	$0 start
	exit $?
	;;
  *)
	gprintf "$0 {start|stop|restart|reload|status}\n"
	exit 1
esac

exit $RETVAL