aboutsummaryrefslogtreecommitdiffstats
path: root/main/quagga-nhrp/zebra.initd
blob: 6ab297e74fd543eb0ecf8dc17b6410c2611975eb (plain)
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
#!/sbin/openrc-run

piddir=/var/run/quagga
pidfile=$piddir/$SVCNAME.pid
command=/usr/sbin/$SVCNAME
command_args="-d -f /etc/quagga/$SVCNAME.conf --pid_file $pidfile"

depend() {
	need net
	after firewall opennhrp
}

cleanup() {
	ebegin "Cleaning up stale zebra routes..."
	ip route flush proto zebra
	eend $?
}

checkconfig() {
	if ! [ -e /etc/quagga/$SVCNAME.conf ] ; then
		eerror "You need to create /etc/quagga/$SVCNAME.conf first."
		eerror "An example can be found in /usr/share/doc/quagga/$SVCNAME.conf.sample"
		eerror "from quagga-doc package"
		return 1
	fi
	return 0
}

start_pre() {
	checkconfig || return 1
	checkpath --owner quagga:quagga --directory $piddir
	cleanup
}