babel: clean up init script, fix interface settings as with ahcpd
git-svn-id: svn://svn.openwrt.org/openwrt/packages@18863 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
87340f10d9
commit
4d10ee4dd1
@ -1,2 +1,2 @@
|
|||||||
config babeld
|
config babeld
|
||||||
option interfaces "wl0"
|
#list 'interface' 'wlan'
|
||||||
|
@ -2,49 +2,17 @@
|
|||||||
|
|
||||||
START=70
|
START=70
|
||||||
|
|
||||||
pidfile=/var/run/babeld.pid
|
babel_addif() {
|
||||||
|
config_get ifname $1 ifname
|
||||||
babeld_config() {
|
append interfaces "$ifname"
|
||||||
local cfg="$1"
|
|
||||||
config_get interfaces "$cfg" interfaces
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
|
||||||
config_load babeld
|
|
||||||
config_foreach babeld_config babeld
|
|
||||||
mkdir -p /var/lib
|
|
||||||
if [ -e $pidfile ] ; then
|
|
||||||
echo "$pidfile exists -- not starting babel." >&2
|
|
||||||
else
|
|
||||||
/usr/sbin/babeld -D -I $pidfile $interfaces
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
[ -e $pidfile ] && kill $(cat $pidfile)
|
|
||||||
[ -e $pidfile ] && sleep 2
|
|
||||||
[ -e $pidfile ] && sleep 4
|
|
||||||
[ -e $pidfile ] && echo "Failed to stop babel ($pidfile still exists)."
|
|
||||||
}
|
|
||||||
#!/bin/sh /etc/rc.common
|
|
||||||
|
|
||||||
START=70
|
|
||||||
|
|
||||||
pidfile=/var/run/babeld.pid
|
|
||||||
|
|
||||||
babel_config() {
|
babel_config() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
config_get interfaces "$cfg" interfaces
|
interfaces=
|
||||||
}
|
config_list_foreach "$cfg" interface babel_addif
|
||||||
|
pidfile=/var/run/babeld-"$cfg".pid
|
||||||
start() {
|
[ -z "$interfaces" ] && return 0
|
||||||
if [ -x /etc/rc.d/S71ahcpd ] ; then
|
|
||||||
echo 'Not starting babel -- will be started by ahcpd.'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
config_load babel
|
|
||||||
config_foreach babel_config babel
|
|
||||||
mkdir -p /var/lib
|
|
||||||
if [ -e $pidfile ] ; then
|
if [ -e $pidfile ] ; then
|
||||||
echo "$pidfile exists -- not starting babel." >&2
|
echo "$pidfile exists -- not starting babel." >&2
|
||||||
else
|
else
|
||||||
@ -52,9 +20,19 @@ start() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
start() {
|
||||||
[ -e $pidfile ] && kill $(cat $pidfile)
|
if [ -x /etc/init.d/ahcpd ] && /etc/init.d/ahcpd enabled; then
|
||||||
[ -e $pidfile ] && sleep 2
|
echo 'Not starting babel -- will be started by ahcpd.'
|
||||||
[ -e $pidfile ] && sleep 4
|
exit 0
|
||||||
[ -e $pidfile ] && echo "Failed to stop babel ($pidfile still exists)."
|
fi
|
||||||
|
include /lib/network
|
||||||
|
scan_interfaces
|
||||||
|
config_load babel
|
||||||
|
mkdir -p /var/lib
|
||||||
|
config_foreach babel_config babel
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
kill $(cat /var/run/babeld-*.pid)
|
||||||
|
rm -f /var/run/babeld-*.pid
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user