#!/bin/bash # # chkconfig: 2345 15 15 # description: GPM adds mouse support to text-based Linux applications such \ # the Midnight Commander. Is also allows mouse-based console \ # cut-and-paste operations, and includes support for pop-up \ # menus on the console. # processname: gpm # pidfile: /var/run/gpm.pid # config: /etc/sysconfig/mouse # ### BEGIN INIT INFO # Provides: gpm # Should-Start: harddrake # Default-Start: 2 3 4 5 # Short-Description: Mouse support for text-based applications # Description: GPM adds mouse support to text-based Linux applications such \ # the Midnight Commander. Is also allows mouse-based console \ # cut-and-paste operations, and includes support for pop-up \ # menus on the console. ### END INIT INFO # source function library . /etc/rc.d/init.d/functions MOUSECFG=/etc/sysconfig/mouse MOUSEDEVICE=/dev/mouse RETVAL=0 case "$1" in start) gprintf "Starting console mouse services: " if [ -f "$MOUSECFG" ]; then . "$MOUSECFG" else gprintf "(no mouse is configured)\n" exit 0 fi if [ -n "$device" ];then MOUSEDEVICE=/dev/$device fi if [ ! -e $MOUSEDEVICE ];then gprintf "%s don't exist\n" "$MOUSEDEVICE" exit 0 fi if [ "$MOUSETYPE" = "none" ]; then gprintf "(no mouse is configured)\n" exit 0 fi if [ "$MOUSETYPE" = "Microsoft" ]; then MOUSETYPE=ms fi if [ -n "$MOUSETYPE" ]; then daemon gpm -m $MOUSEDEVICE -t $MOUSETYPE else daemon gpm -m $MOUSEDEVICE fi RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gpm ;; stop) gprintf "Shutting down console mouse services: " killproc gpm RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/gpm ;; restart|reload) $0 stop $0 start RETVAL=$? ;; status) status gpm RETVAL=$? ;; *) gprintf "Usage: gpm {start|stop|status|restart|reload}\n" exit 1 esac exit $RETVAL