From d910dd9a2698f241f580e20db462b55158c5a56e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 20 Dec 2009 18:36:13 +0000 Subject: [PATCH] babel: clean up init script, fix interface settings as with ahcpd SVN-Revision: 18863 --- net/babel/files/babeld.config | 2 +- net/babel/files/babeld.init | 52 ++++++++++------------------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/net/babel/files/babeld.config b/net/babel/files/babeld.config index b512c3a20..3b0fb38fc 100644 --- a/net/babel/files/babeld.config +++ b/net/babel/files/babeld.config @@ -1,2 +1,2 @@ config babeld - option interfaces "wl0" + #list 'interface' 'wlan' diff --git a/net/babel/files/babeld.init b/net/babel/files/babeld.init index 6d0eb192d..12fa90e2e 100755 --- a/net/babel/files/babeld.init +++ b/net/babel/files/babeld.init @@ -2,17 +2,17 @@ START=70 -pidfile=/var/run/babeld.pid - -babeld_config() { - local cfg="$1" - config_get interfaces "$cfg" interfaces +babel_addif() { + config_get ifname $1 ifname + append interfaces "$ifname" } -start() { - config_load babeld - config_foreach babeld_config babeld - mkdir -p /var/lib +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 @@ -20,41 +20,19 @@ start() { 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() { - local cfg="$1" - config_get interfaces "$cfg" interfaces -} - start() { - if [ -x /etc/rc.d/S71ahcpd ] ; then + 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 babel - config_foreach babel_config babel mkdir -p /var/lib - if [ -e $pidfile ] ; then - echo "$pidfile exists -- not starting babel." >&2 - else - /usr/sbin/babeld -D -I $pidfile $interfaces - fi + config_foreach babel_config babel } stop() { - [ -e $pidfile ] && kill $(cat $pidfile) - [ -e $pidfile ] && sleep 2 - [ -e $pidfile ] && sleep 4 - [ -e $pidfile ] && echo "Failed to stop babel ($pidfile still exists)." + kill $(cat /var/run/babeld-*.pid) + rm -f /var/run/babeld-*.pid } -- 2.30.2