aboutsummaryrefslogtreecommitdiff
path: root/net/silc-server/files/silcd.in
blob: 2af1718ad5f017b297b9b16525332827b6719860 (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
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: silcd
# REQUIRE: NETWORKING
#
# Add the following line to /etc/rc.conf[.local] to enable silcd:
#
# silcd_enable="YES"
#

silcd_enable=${silcd_enable-"NO"}

. /etc/rc.subr

name=silcd
rcvar=`set_rcvar`

command=%%PREFIX%%/sbin/${name}
pidfile=/var/run/${name}.pid

extra_commands="keygen"
keygen_cmd="silcd_keygen"
start_precmd="silcd_precmd"

silcd_keygen()
{
	umask 077
	${command} -C %%PREFIX%%/etc/silc
}

silcd_precmd()
{
	if [ ! -f %%PREFIX%%/etc/silc/silcd.prv -a ! -f %%PREFIX%%/etc/silc/silcd.pub ]; then
		run_rc_command keygen
	fi
}

load_rc_config ${name}
run_rc_command "$1"