packages/net/babel/files/babeld.init

39 lines
753 B
Plaintext
Raw Normal View History

#!/bin/sh /etc/rc.common
START=70
babel_addif() {
config_get ifname $1 ifname
append interfaces "$ifname"
}
babel_config() {
local cfg="$1"
interfaces=
config_list_foreach "$cfg" interface babel_addif
pidfile=/var/run/babeld-"$cfg".pid
[ -z "$interfaces" ] && return 0
if [ -e $pidfile ] ; then
echo "$pidfile exists -- not starting babel." >&2
else
/usr/sbin/babeld -D -I $pidfile $interfaces
fi
}
start() {
if [ -x /etc/init.d/ahcpd ] && /etc/init.d/ahcpd enabled; then
echo 'Not starting babel -- will be started by ahcpd.'
exit 0
fi
include /lib/network
scan_interfaces
config_load babeld
mkdir -p /var/lib
config_foreach babel_config babeld
}
stop() {
kill $(cat /var/run/babeld-*.pid)
rm -f /var/run/babeld-*.pid
}