aboutsummaryrefslogtreecommitdiff
path: root/sysutils/keyboard-daemon/files/keyboard_daemon.in
blob: a24e34e2955f56cf7c3ee0b1e94d5391f85776b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: keyboard_daemon
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable this service:
#
# keyboard_daemon_enable:	Set to no by default; set to yes to enable it.
# keyboard_daemon_device:	Set to the name of your keyboard device, such
#				as /dev/ukbd0
#				CARE-- this will disconnect your keyboard from
#				the kbdmux, do not use on your only keyboard!
#
# Optional:
#
# keyboard_daemon_conf:		Defaults to %%PREFIX%%/etc/keyboard-daemon.conf

. /etc/rc.subr

name=keyboard_daemon
rcvar=keyboard_daemon_enable

load_rc_config keyboard_daemon

: ${keyboard_daemon_enable:=no}

pidfile=/var/run/keyboard-daemon.pid
required_files=${keyboard_daemon_conf}
command=%%PREFIX%%/bin/keyboard-daemon
command_args="-d -p $pidfile ${keyboard_daemon_conf+-f keyboard_daemon_conf} /dev/ukbd0"

start_precmd=keyboard_daemon_prestart
stop_postcmd="kbdcontrol -a ${keyboard_daemon_device} < /dev/console"

keyboard_daemon_prestart()
{
	: ${keyboard_daemon_device:?keyboard_daemon_device must be set in rc.conf}
	kbdcontrol -A ${keyboard_daemon_device##*/} < /dev/console
}

run_rc_command $1