freebsd-ports/sysutils/uhidd/files/uhidd.in
Doug Barton 1d6b4b3f91 Begin the process of deprecating sysutils/rc_subr by
s#. %%RC_SUBR%%#. /etc/rc.subr#
2010-03-27 00:15:24 +00:00

49 lines
840 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: uhidd
# REQUIRE: DAEMON cleanvar
# KEYWORD: nojail shutdown
. /etc/rc.subr
# Usage:
# uhidd start ugenX.Y # start uhidd on device 'ugenX.Y'
# uhidd stop ugenX.Y # stop uhidd on device 'ugenX.Y'
# uhidd start # start uhidd on all ugen device.
# uhidd stop # stop all uhidd instances.
name="uhidd"
rcvar=`set_rcvar`
command="%%PREFIX%%/sbin/${name}"
start_cmd="uhidd_start"
required_modules="uvhid vkbd"
pidprefix="/var/run/uhidd"
load_rc_config $name
if [ -n "$2" ]; then
pidfile="${pidprefix}.`basename $2`.pid"
else
pidfile=
fi
uhidd_start()
{
local dev pf
if [ -n "$1" ]; then
${command} ${uhidd_flags} $1
else
for dev in /dev/ugen*; do
pf="${pidprefix}.`basename ${dev}`.pid"
if [ ! -f ${pf} ]; then
${command} ${uhidd_flags} ${dev}
fi
done
fi
}
run_rc_command $*