]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - etc/rc.d/moused
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / etc / rc.d / moused
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: moused
7 # REQUIRE: DAEMON FILESYSTEMS
8 # KEYWORD: nojail shutdown
9
10 . /etc/rc.subr
11
12 name="moused"
13 rcvar="moused_enable"
14 command="/usr/sbin/${name}"
15 start_cmd="moused_start"
16 pidprefix="/var/run/moused"
17 pidfile="${pidprefix}.pid"
18 pidarg=
19 load_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 #
24 if [ -n "$2" ]; then
25         eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
26         rcvar="moused_${2}_enable"
27         pidfile="${pidprefix}.$2.pid"
28         pidarg="-I $pidfile"
29 fi
30
31 moused_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         check_startmsgs && echo -n "Starting ${ms} moused"
55         /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
56         check_startmsgs && echo '.'
57
58         mousechar_arg=
59         case ${mousechar_start} in
60         [Nn][Oo] | '')
61                 ;;
62         *)
63                 mousechar_arg="-M ${mousechar_start}"
64                 ;;
65         esac
66
67         for ttyv in /dev/ttyv* ; do
68                 vidcontrol < ${ttyv} ${mousechar_arg} -m on
69         done
70 }
71
72 run_rc_command $*