2008-05-29 20:58:34 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
|
|
|
|
START=70
|
|
|
|
|
2009-12-20 18:36:13 +00:00
|
|
|
babel_addif() {
|
|
|
|
config_get ifname $1 ifname
|
|
|
|
append interfaces "$ifname"
|
2009-11-22 04:02:17 +00:00
|
|
|
}
|
|
|
|
|
2009-12-20 18:36:13 +00:00
|
|
|
babel_config() {
|
|
|
|
local cfg="$1"
|
|
|
|
interfaces=
|
|
|
|
config_list_foreach "$cfg" interface babel_addif
|
|
|
|
pidfile=/var/run/babeld-"$cfg".pid
|
|
|
|
[ -z "$interfaces" ] && return 0
|
2009-11-22 04:02:17 +00:00
|
|
|
if [ -e $pidfile ] ; then
|
|
|
|
echo "$pidfile exists -- not starting babel." >&2
|
|
|
|
else
|
|
|
|
/usr/sbin/babeld -D -I $pidfile $interfaces
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2008-05-29 20:58:34 +00:00
|
|
|
start() {
|
2009-12-20 18:36:13 +00:00
|
|
|
if [ -x /etc/init.d/ahcpd ] && /etc/init.d/ahcpd enabled; then
|
2008-05-29 20:58:34 +00:00
|
|
|
echo 'Not starting babel -- will be started by ahcpd.'
|
|
|
|
exit 0
|
|
|
|
fi
|
2009-12-20 18:36:13 +00:00
|
|
|
include /lib/network
|
|
|
|
scan_interfaces
|
2009-12-21 03:39:21 +00:00
|
|
|
config_load babeld
|
2008-05-29 20:58:34 +00:00
|
|
|
mkdir -p /var/lib
|
2009-12-21 03:39:21 +00:00
|
|
|
config_foreach babel_config babeld
|
2008-05-29 20:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2009-12-20 18:36:13 +00:00
|
|
|
kill $(cat /var/run/babeld-*.pid)
|
|
|
|
rm -f /var/run/babeld-*.pid
|
2008-05-29 20:58:34 +00:00
|
|
|
}
|