freebsd-skq/etc/rc.d/moused
dougb 1eae783464 In regards to the "Starting foo:" type messages at boot time, create and
employ a more generic solution, and use it in the individual rc.d scripts
that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not expect
there to be anything printed out in between to make it more consistent.
5. In the following scripts change "quotes" to 'quotes' where no variables
exist in the message: savecore pf newsyslog
6. In the following scripts substitute if/then/fi for the simpler (and
more consistent) check_startmsgs &&: faith stf
7. In the following scripts separate the "Starting foo:" from the terminal
'.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency
2009-10-10 22:17:03 +00:00

73 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: moused
# REQUIRE: DAEMON cleanvar
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="moused"
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
start_cmd="moused_start"
pidprefix="/var/run/moused"
pidfile="${pidprefix}.pid"
pidarg=
load_rc_config $name
# Set the pid file and variable name. The second argument, if it exists, is
# expected to be the mouse device.
#
if [ -n "$2" ]; then
eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
rcvar=`set_rcvar moused_$2`
pidfile="${pidprefix}.$2.pid"
pidarg="-I $pidfile"
fi
moused_start()
{
local ms myflags myport mytype
# Set the mouse device and get any related variables. If
# a moused device has been specified on the commandline, then
# rc.conf(5) variables defined for that device take precedence
# over the generic moused_* variables. The only exception is
# the moused_port variable, which if not defined sets it to the
# passed in device name.
#
ms=$1
if [ -n "$ms" ]; then
eval myflags=\${moused_${ms}_flags-$moused_flags}
eval myport=\${moused_${ms}_port-/dev/$ms}
eval mytype=\${moused_${ms}_type-$moused_type}
else
ms="default"
myflags="$moused_flags"
myport="$moused_port"
mytype="$moused_type"
fi
check_startmsgs && echo -n "Starting ${ms} moused"
/usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
check_startmsgs && echo '.'
mousechar_arg=
case ${mousechar_start} in
[Nn][Oo] | '')
;;
*)
mousechar_arg="-M ${mousechar_start}"
;;
esac
for ttyv in /dev/ttyv* ; do
vidcontrol < ${ttyv} ${mousechar_arg} -m on
done
}
run_rc_command $*