summaryrefslogtreecommitdiff
path: root/net/routinator/files/routinator.in
blob: 449313463a1797b1dfa6ecafae523ae3d76e605b (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

# PROVIDE: routinator
# REQUIRE: DAEMON
# BEFORE:  LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name=routinator
desc="RPKI signed route collector and validator"
rcvar="routinator_enable"
start_precmd=check_init
command="%%PREFIX%%/bin/${name}"

load_rc_config ${name}

: ${name_enable=:"NO"}
: ${wrkdir:="/var/routinator"}

pidfile=${wrkdir}/${name}.pid
routinator_config=${routinator_conf:-"%%ETCDIR%%/routinator.conf"}
required_file=${routinator_config}
command_args="-c ${routinator_config} --rsync-command=%%PREFIX%%/bin/rsync server -d --user %%USERS%% --group %%GROUPS%% --pid-file=${pidfile} --working-dir=${wrkdir}"

check_init() {
	if [ ! -d ${wrkdir}/tals ]; then
		echo
		echo -n "Need to initialize routinator with tals, "
		echo "see man routinator"
		echo
		exit 1
	fi
	if [ ! -d ${wrkdir} ]; then
		echo
		echo -n "Need to create repository ${wrkdir}"
		echo  "and populate with tals, "
		echo "see man routinator"
		echo
		exit 1
	fi
}

run_rc_command "$1"