Repository : ssh://git@open-mesh.org/openwrt-feed-batman-adv
On branch : master
commit a832a799a31bd3361e303eaf2b054cf5c8fe6f5a Author: Marek Lindner lindner_marek@yahoo.de Date: Sun Aug 21 23:14:26 2011 +0000
batman-adv-devel: updating to latest git version & split init files
a832a799a31bd3361e303eaf2b054cf5c8fe6f5a batman-adv-devel/Makefile | 10 +- batman-adv-devel/files/etc/init.d/batman-adv | 98 +------------------- .../init.d/batman-adv => lib/batman-adv/config.sh} | 28 +----- 3 files changed, 8 insertions(+), 128 deletions(-)
diff --git a/batman-adv-devel/Makefile b/batman-adv-devel/Makefile index e00105e..b338f44 100644 --- a/batman-adv-devel/Makefile +++ b/batman-adv-devel/Makefile @@ -10,8 +10,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv-devel
-PKG_BATMAN_REV:=8c1fb2c2aa1ed1f5fa67a7d3459a9b6428aa337f -PKG_BATCTL_REV:=27b695b97cf0d6813e3e9951538186e15ad62068 +PKG_BATMAN_REV:=d5efe7cd4d42d141056c1dd6c6498d168fcf66b7 +PKG_BATCTL_REV:=0a284c579e26edc603f46f71684ee66f8bfc0a68
PKG_BATMAN_SHORTREV:=$(shell echo $(PKG_BATMAN_REV) | cut -c1-7) PKG_BATMAN_FNAME:=batman-adv-devel-$(PKG_BATMAN_SHORTREV).tar.gz @@ -109,16 +109,18 @@ endef
ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_DEVEL_BATCTL),) define KernelPackage/batman-adv-devel/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d + $(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/ endef else define KernelPackage/batman-adv-devel/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d + $(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config endef endif diff --git a/batman-adv-devel/files/etc/init.d/batman-adv b/batman-adv-devel/files/etc/init.d/batman-adv index a6a8500..f0f6789 100644 --- a/batman-adv-devel/files/etc/init.d/batman-adv +++ b/batman-adv-devel/files/etc/init.d/batman-adv @@ -3,101 +3,7 @@
START=90
-is_module_loaded() { - - if [ ! -d "/sys/module/batman_adv" ]; then - echo "batman-adv module directory not found - was the kernel module loaded ?" >&2 - return 0 - fi - - return 1 -} - -start_mesh () { - local meshif="$1" - local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode - - is_module_loaded - [ $? -ne 1 ] && return - - config_get interfaces "$meshif" interfaces - config_get aggregated_ogms "$meshif" aggregated_ogms - config_get bonding "$meshif" bonding - config_get fragmentation "$meshif" fragmentation - config_get gw_bandwidth "$meshif" gw_bandwidth - config_get gw_mode "$meshif" gw_mode - config_get gw_sel_class "$meshif" gw_sel_class - config_get log_level "$meshif" log_level - config_get orig_interval "$meshif" orig_interval - config_get vis_mode "$meshif" vis_mode - - if [ "$interfaces" = "" ]; then - echo Error, you must specify at least a network interface - return - fi - - for interface in $interfaces - do - ifname=$(uci -P /var/state get network.$interface.ifname 2>&-) - [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && { - ifname=${interface} - [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue - } - - echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface - done - - if [ $orig_interval ]; then - echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval - fi - - if [ $log_level ]; then - echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&- - fi - - if [ $aggregated_ogms ]; then - echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms - fi - - if [ $bonding ]; then - echo $bonding > /sys/class/net/$meshif/mesh/bonding - fi - - if [ $fragmentation ]; then - echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation - fi - - if [ $gw_bandwidth ]; then - echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth - fi - - if [ $gw_mode ]; then - echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode - fi - - if [ $gw_sel_class ]; then - echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class - fi - - if [ $vis_mode ]; then - echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode - fi -} - -stop_mesh() { - local meshif="$1" - - is_module_loaded - [ $? -ne 1 ] && return - - for iface in $(ls /sys/class/net/*) - do - [ ! -f "$iface/batman_adv/mesh_iface" ] && continue - [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue - - echo "none" > $iface/batman_adv/mesh_iface - done -} +. /lib/batman-adv/config.sh
# can also be used with "batman-adv start bat0" start() { @@ -120,5 +26,3 @@ stop () { config_foreach stop_mesh mesh fi } - - diff --git a/batman-adv-devel/files/etc/init.d/batman-adv b/batman-adv-devel/files/lib/batman-adv/config.sh similarity index 87% copy from batman-adv-devel/files/etc/init.d/batman-adv copy to batman-adv-devel/files/lib/batman-adv/config.sh index a6a8500..347e307 100644 --- a/batman-adv-devel/files/etc/init.d/batman-adv +++ b/batman-adv-devel/files/lib/batman-adv/config.sh @@ -1,8 +1,6 @@ -#!/bin/sh /etc/rc.common +#!/bin/sh # Copyright (C) 2011 OpenWrt.org
-START=90 - is_module_loaded() {
if [ ! -d "/sys/module/batman_adv" ]; then @@ -98,27 +96,3 @@ stop_mesh() { echo "none" > $iface/batman_adv/mesh_iface done } - -# can also be used with "batman-adv start bat0" -start() { - config_load batman-adv - - if [ -n "$1" ]; then - start_mesh $1 - else - config_foreach start_mesh mesh - fi -} - -# can also be used with "batman-adv stop bat0" -stop () { - config_load batman-adv - - if [ -n "$1" ]; then - stop_mesh $1 - else - config_foreach stop_mesh mesh - fi -} - -