kernel - Make certain sysctl's unlocked
[dragonfly.git] / etc / rc.d / moused
blobd1a022c24ca8efcd948b19adb09fd67c66c5f07a
1 #!/bin/sh
3 # $FreeBSD: head/etc/rc.d/moused 240336 2012-09-11 05:04:59Z obrien $
6 # PROVIDE: moused
7 # REQUIRE: DAEMON
9 . /etc/rc.subr
11 name=moused
12 rcvar=`set_rcvar`
13 command="/usr/sbin/${name}"
14 start_cmd="moused_start"
15 pidprefix="/var/run/moused"
16 pidfile="${pidprefix}.pid"
17 pidarg=
18 load_rc_config $name
20 # Set the pid file and variable name. The second argument, if it exists, is
21 # expected to be the mouse device.
23 if [ -n "$2" ]; then
24 eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
25 rcvar="moused_${2}_enable"
26 pidfile="${pidprefix}.$2.pid"
27 pidarg="-I $pidfile"
30 moused_start()
32 # Set the mouse device and get any related variables. If
33 # a moused device has been specified on the commandline, then
34 # rc.conf(5) variables defined for that device take precedence
35 # over the generic moused_* variables. The only exception is
36 # the moused_port variable, which if not defined sets it to the
37 # passed in device name.
39 ms=$1
40 if [ -n "$ms" ]; then
41 eval myflags=\${moused_${ms}_flags-$moused_flags}
42 eval myport=\${moused_${ms}_port-/dev/$ms}
43 eval mytype=\${moused_${ms}_type-$moused_type}
44 else
45 ms="default"
46 myflags="$moused_flags"
47 myport="$moused_port"
48 mytype="$moused_type"
51 check_startmsgs && echo -n "Starting ${ms} moused"
52 /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
53 check_startmsgs && echo '.'
55 mousechar_arg=
56 case ${mousechar_start} in
57 [Nn][Oo] | '')
60 mousechar_arg="-M ${mousechar_start}"
62 esac
64 for ttyv in /dev/ttyv* ; do
65 vidcontrol < ${ttyv} ${mousechar_arg} -m on
66 done
69 run_rc_command $*