moused revision 180563
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/moused 180563 2008-07-16 19:22:48Z dougb $ 4# 5 6# PROVIDE: moused 7# REQUIRE: DAEMON cleanvar 8# KEYWORD: nojail 9 10. /etc/rc.subr 11 12name=moused 13rcvar=`set_rcvar` 14command="/usr/sbin/${name}" 15start_cmd="moused_start" 16pidprefix="/var/run/moused" 17pidfile="${pidprefix}.pid" 18pidarg= 19load_rc_config $name 20 21# Set the pid file and variable name. The second argument, if it exists, is 22# expected to be the mouse device. 23# 24if [ -n "$2" ]; then 25 eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}} 26 rcvar=`set_rcvar moused_$2` 27 pidfile="${pidprefix}.$2.pid" 28 pidarg="-I $pidfile" 29fi 30 31moused_start() 32{ 33 local ms myflags myport mytype 34 35 # Set the mouse device and get any related variables. If 36 # a moused device has been specified on the commandline, then 37 # rc.conf(5) variables defined for that device take precedence 38 # over the generic moused_* variables. The only exception is 39 # the moused_port variable, which if not defined sets it to the 40 # passed in device name. 41 # 42 ms=$1 43 if [ -n "$ms" ]; then 44 eval myflags=\${moused_${ms}_flags-$moused_flags} 45 eval myport=\${moused_${ms}_port-/dev/$ms} 46 eval mytype=\${moused_${ms}_type-$moused_type} 47 else 48 ms="default" 49 myflags="$moused_flags" 50 myport="$moused_port" 51 mytype="$moused_type" 52 fi 53 54 [ -z "${rc_quiet}" ] && echo -n "Starting ${ms} moused." 55 /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} 56 57 mousechar_arg= 58 case ${mousechar_start} in 59 [Nn][Oo] | '') 60 ;; 61 *) 62 mousechar_arg="-M ${mousechar_start}" 63 ;; 64 esac 65 66 for ttyv in /dev/ttyv* ; do 67 vidcontrol < ${ttyv} ${mousechar_arg} -m on 68 done 69} 70 71run_rc_command $* 72