batman-adv: few makefile changes & upgrade dev to latest
authorMarek Lindner <lindner_marek@yahoo.de>
Sun, 23 May 2010 13:17:09 +0000 (13:17 +0000)
committerMarek Lindner <lindner_marek@yahoo.de>
Sun, 23 May 2010 13:17:09 +0000 (13:17 +0000)
SVN-Revision: 21541

net/batman-advanced/Makefile
net/batman-advanced/files/etc/config/batman-adv [new file with mode: 0644]
net/batman-advanced/files/etc/config/batman-adv-kernelland [deleted file]
net/batman-advanced/files/etc/init.d/batman-adv [new file with mode: 0644]
net/batman-advanced/files/etc/init.d/batman-adv-kernelland [deleted file]

index 9dff00857e8c7a78272ef3c32070ed345cfd7104..fe9243df7809aa2db8d9496f86cb027f3980fa96 100644 (file)
@@ -9,23 +9,42 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
-PKG_REV:=1611
-PKG_VERSION:=r$(PKG_REV)
-PKG_RELEASE:=1
 
+# Versions to download for maintenance build
+PKG_REV_MAINT:=1611
+PKG_KMOD_VERSION_MAINT:=5c4633c532a7a9b5adfe5dbf3f5e97fff307216e
+# just for the package version numbering
+PKG_VERSION_MAINT:=0.2.1
+# Versions to download for development build
+PKG_REV_DEV:=1679
+PKG_KMOD_VERSION_DEV:=de32ed5ba4b6487dbd3c4cad6c9ba8240d79c421
+# just for the package version numbering
+PKG_VERSION_DEV:=0.3.0a
+## Make sure git-commit hash and svn revision number fit! ##
+
+PKG_RELEASE:=1
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-PKG_TOOL_VERSION=$(PKG_REV)
 
 ifneq ($(CONFIG_BATMAN_ADV_DEV),)
-       PKG_KMOD_VERSION=f9c84f3d20df87f4ebbc38b754b6b13fc1593ce2
+       PKG_REV:=$(PKG_REV_DEV)
+       PKG_VERSION:=$(PKG_VERSION_DEV)
+       PKG_KMOD_VERSION=$(PKG_KMOD_VERSION_DEV)
+       PKG_KMOD_URL=http://git.open-mesh.org/snapshot/$(PKG_KMOD_VERSION)/
        PKG_KMOD_FNAME=batman-adv-dev-$(PKG_REV).tar.gz
+       PKG_TOOL_VERSION=$(PKG_REV)
+       PKG_TOOL_PROTO=svn
        PKG_TOOL_URL=http://downloads.open-mesh.org/svn/batman/trunk/batctl
        PKG_TOOL_FNAME:=batctl-dev-$(PKG_TOOL_VERSION).tar.gz
 else
-       PKG_KMOD_VERSION=5c4633c532a7a9b5adfe5dbf3f5e97fff307216e
+       PKG_REV:=$(PKG_REV_MAINT)
+       PKG_VERSION:=$(PKG_VERSION_MAINT)
+       PKG_KMOD_VERSION=$(PKG_KMOD_VERSION_MAINT)
+       PKG_KMOD_URL=http://git.open-mesh.org/snapshot/$(PKG_KMOD_VERSION)/
        PKG_KMOD_FNAME=batman-adv-maint-$(PKG_REV).tar.gz
+       PKG_TOOL_VERSION=$(PKG_REV)
+       PKG_TOOL_PROTO=svn
        PKG_TOOL_URL=http://downloads.open-mesh.org/svn/batman/branches/batctl-0.2.x/
        PKG_TOOL_FNAME:=batctl-maint-$(PKG_TOOL_VERSION).tar.gz
 endif
@@ -69,7 +88,7 @@ endef
 
 define Download/batman-adv-kernelland
   FILE:=$(PKG_KMOD_FNAME)
-  URL:=http://git.open-mesh.org/snapshot/$(PKG_KMOD_VERSION)/
+  URL:=$(PKG_KMOD_URL)
 endef
 $(eval $(call Download,batman-adv-kernelland))
 
@@ -77,7 +96,7 @@ ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
 define Download/batctl
   FILE:=$(PKG_TOOL_FNAME)
   URL:=$(PKG_TOOL_URL)
-  PROTO:=svn
+  PROTO:=$(PKG_TOOL_PROTO)
   VERSION:=$(PKG_TOOL_VERSION)
   SUBDIR:=$(PKG_SOURCE_SUBDIR)/batctl
 endef
@@ -157,8 +176,8 @@ endef
 
 define KernelPackage/batman-adv-kernelland/install
        $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
-       $(INSTALL_BIN) ./files/etc/init.d/batman-adv-kernelland $(1)/etc/init.d
-       $(INSTALL_DATA) ./files/etc/config/batman-adv-kernelland $(1)/etc/config
+       $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
 ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batctl $(1)/usr/sbin/
diff --git a/net/batman-advanced/files/etc/config/batman-adv b/net/batman-advanced/files/etc/config/batman-adv
new file mode 100644 (file)
index 0000000..1cb3709
--- /dev/null
@@ -0,0 +1,5 @@
+
+config 'mesh' 'bat0'
+       option 'interfaces' 'wlan0'
+       option 'orig_interval'
+       option 'log_level'
diff --git a/net/batman-advanced/files/etc/config/batman-adv-kernelland b/net/batman-advanced/files/etc/config/batman-adv-kernelland
deleted file mode 100644 (file)
index 2106236..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-config batman-adv-kernelland general
-       option interface                ath0
-       option originator_interval
-       option log_level        
diff --git a/net/batman-advanced/files/etc/init.d/batman-adv b/net/batman-advanced/files/etc/init.d/batman-adv
new file mode 100644 (file)
index 0000000..5f346a7
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/sh /etc/rc.common
+START=90
+
+MODULE_DIR="/sys/module/batman_adv"
+
+detect_version() {
+       local version
+       
+       if [ ! -d "$MODULE_DIR" ]; then
+               echo "batman-adv module directory not found - is the module loaded ?" >&2
+               return 1
+       fi
+       
+       version=$(cat $MODULE_DIR/version)
+
+       if [ "$version" != "${version#0.3*}" ]; then
+               BAT_VER="0.3"
+       elif [ "$version" != "${version#0.2*}" ]; then
+               BAT_VER="0.2"
+       else
+               echo "Error - unknown version encountered: $version" >&2
+               return 1
+       fi
+       
+       return 0
+}
+
+start_mesh () {
+       local meshif="$1"
+       
+       detect_version
+       [ $? -ne 0 ] && return 1
+
+       config_get interfaces "$meshif" interfaces
+       config_get orig_interval "$meshif" orig_interval
+       config_get log_level "$meshif" log_level
+
+       if [ "$interfaces" = "" ]; then
+               echo Error, you must specify at least a network interface
+               return
+       fi
+       
+       for interface in $interfaces 
+          do 
+               if [ "$BAT_VER" = "0.2" ]; then
+                       echo $interface > /proc/net/batman-adv/interfaces 
+               else
+                       [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue
+                       echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface
+               fi
+          done         
+       
+       if [ $orig_interval ]; then
+               if [ "$BAT_VER" = "0.2" ]; then
+                       echo $orig_interval > /proc/net/batman-adv/orig_interval 
+               else
+                       echo $orig_interval > /sys/class/net/$meshif/batman_adv/originator_interval
+               fi
+       fi
+       
+       if [ $log_level ]; then
+               echo $log_level > /sys/module/batman_adv/parameters/debug 2>&-
+       fi
+}
+
+stop_mesh() {
+       local meshif="$1"
+       
+       detect_version
+        [ $? -ne 0 ] && return 1
+        
+        if [ "$BAT_VER" = "0.2" ]; then
+               echo "" > /proc/net/batman-adv/interfaces
+               return
+       fi
+       
+       for iface in $(ls /sys/class/net/*)
+          do
+                [ ! -f "$iface/batman_adv/mesh_iface" ] && continue
+                [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue
+                
+                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
+}
+
+        
diff --git a/net/batman-advanced/files/etc/init.d/batman-adv-kernelland b/net/batman-advanced/files/etc/init.d/batman-adv-kernelland
deleted file mode 100644 (file)
index 9bc2300..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh /etc/rc.common
-START=90
-
-start () {
-       interfaces=$(uci get batman-adv-kernelland.general.interface)
-       if [ "$interfaces" = "" ]; then
-               echo $1 Error, you must specify at least a network interface
-               exit
-       fi
-       
-       for interface in $interfaces 
-          do 
-             echo $interface > /proc/net/batman-adv/interfaces 
-       done    
-       
-       originator_interval=$(uci get batman-adv-kernelland.general.originator_interval)
-       log_level=$(uci get batman-adv-kernelland.general.log_level)
-
-       if [ $originator_interval ]; then
-               echo $originator_interval > /proc/net/batman-adv/orig_interval 
-       fi
-       
-       if [ $log_level ]; then
-               echo $log_level > /sys/module/batman_adv/parameters/debug 2>&-
-       fi
-}
-
-stop () {
-       echo "" > /proc/net/batman-adv/interfaces
-}
-
-