[lib] CID #39, fix leak in error path, vty_describe_command
[jleu-quagga.git] / pkgsrc / zebra.sh.in
blobc2f12a78335bab77438334f1cf8ffceb3beb05df
1 #!/bin/sh
3 # zebra is the head of the quagga routing beast
5 # PROVIDE: zebra
6 # REQUIRE: NETWORKING
7 ##
9 PATH=/sbin:/bin:/usr/sbin:/usr/bin:@prefix@/sbin:@prefix@/bin
10 export PATH
12 if [ -f /etc/rc.subr ]
13 then
14 . /etc/rc.subr
17 name="zebra"
18 rcvar=$name
19 required_files="@sysconfdir@/${name}.conf"
20 command="@prefix@/sbin/${name}"
21 command_args="-d"
23 start_precmd="zebra_precmd"
24 stop_postcmd="zebra_postcmd"
25 socket_dir=@localstatedir@
26 pidfile="${socket_dir}/${name}.pid"
28 zebra_precmd()
30 mkdir -p "${socket_dir}"
31 chown quagga.quagga "${socket_dir}"
32 chmod 750 "${socket_dir}"
33 rc_flags="$(
34 set -- $rc_flags
35 while [ $# -ne 0 ]; do
36 if [ X"$1" = X-P -o X"$1" = X-A ]; then
37 break
39 shift
40 done
41 if [ $# -eq 0 ]; then
42 echo "-P 0"
44 ) $rc_flags"
47 zebra_postcmd()
49 if [ -d "${socketdir}" ]; then
50 rmdir ${socketdir}
54 load_rc_config $name
55 run_rc_command "$1"