bmx6/Makefile: update to current (60adcbd4) bmx6 master branch
[feed/routing.git] / bmxd / files / etc / init.d / bmxd
1 #!/bin/sh /etc/rc.common
2 START=91
3 . /lib/config/uci.sh
4 uci_load bmxd
5 start () {
6 interface="$(uci get bmxd.general.interface)"
7 if [ "$interface" = "" ]; then
8 echo $1 Error, you must specify at least a network interface
9 exit
10 fi
11 announce=$(uci get bmxd.general.announce)
12 gateway_class=$(uci get bmxd.general.gateway_class)
13 originator_interval=$(uci get bmxd.general.originator_interval)
14 preferred_gateway=$(uci get bmxd.general.preferred_gateway)
15 routing_class=$(uci get bmxd.general.routing_class)
16 visualisation_srv=$(uci get bmxd.general.visualisation_srv)
17 misc="$(uci get bmxd.general.misc)"
18 bmx_args=""
19
20 if [ $announce ]; then
21 bmx_args=${bmx_args}'-a '$announce' '
22 fi
23
24 if [ $gateway_class ]; then
25 bmx_args=${bmx_args}'-g '$gateway_class' '
26 fi
27
28 if [ $originator_interval ]; then
29 bmx_args=${bmx_args}'-o '$originator_interval' '
30 fi
31
32 if [ $preferred_gateway ]; then
33 bmx_args=${bmx_args}'-p '$preferred_gateway' '
34 fi
35
36 if [ $routing_class ]; then
37 bmx_args=${bmx_args}'-r '$routing_class' '
38 fi
39
40 if [ $visualisation_srv ]; then
41 bmx_args=${bmx_args}'-s '$visualisation_srv' '
42 fi
43
44
45 bmx_args="$misc ${bmx_args} $interface"
46 bmxd $bmx_args >/dev/null 2>&1
47 }
48
49 stop () {
50 killall bmxd
51 }