moused revision 179945
12116Sjkh#!/bin/sh 22116Sjkh# 32116Sjkh# $FreeBSD: head/etc/rc.d/moused 179945 2008-06-23 04:46:54Z mtm $ 42116Sjkh# 52116Sjkh 62116Sjkh# PROVIDE: moused 72116Sjkh# REQUIRE: DAEMON cleanvar 88870Srgrimes# KEYWORD: nojail 92116Sjkh 102116Sjkh. /etc/rc.subr 112116Sjkh 122116Sjkhname=moused 132116Sjkhrcvar=`set_rcvar` 148870Srgrimescommand="/usr/sbin/${name}" 152116Sjkhstart_cmd="moused_start" 162116Sjkhpidprefix="/var/run/moused" 172116Sjkhpidfile="${pidprefix}.pid" 182116Sjkhpidarg= 192116Sjkhload_rc_config $name 202116Sjkh 212116Sjkh# Set the pid file and variable name. The second argument, if it exists, is 222116Sjkh# expected to be the mouse device. 232116Sjkh# 242116Sjkhif [ -n "$2" ]; then 252116Sjkh eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}} 262116Sjkh rcvar=`set_rcvar moused_$2` 272116Sjkh pidfile="${pidprefix}.$2.pid" 282116Sjkh pidarg="-I $pidfile" 292116Sjkhfi 302116Sjkh 312116Sjkhmoused_start() 322116Sjkh{ 332116Sjkh local ms myflags myport mytype 342116Sjkh 352116Sjkh # Set the mouse device and get any related variables. If 362116Sjkh # a moused device has been specified on the commandline, then 372116Sjkh # rc.conf(5) variables defined for that device take precedence 382116Sjkh # over the generic moused_* variables. The only exception is 398870Srgrimes # the moused_port variable, which if not defined sets it to the 402116Sjkh # passed in device name. 418870Srgrimes # 422116Sjkh 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