add B.A.T.M.A.N. from #1448
authorTravis Kemen <thepeople@openwrt.org>
Sat, 17 Mar 2007 03:59:59 +0000 (03:59 +0000)
committerTravis Kemen <thepeople@openwrt.org>
Sat, 17 Mar 2007 03:59:59 +0000 (03:59 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman@6592 3c298f89-4303-0410-b956-a3cf2f4a3e73

Makefile [new file with mode: 0644]
files/etc/config/batman [new file with mode: 0644]
files/etc/init.d/batman [new file with mode: 0644]
patches/100-makefile.patch [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..3f07441
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,57 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=batman-III
+PKG_VERSION:=0.2.0a
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tbz2
+PKG_SOURCE_URL:=http://downloads.open-mesh.net/batman
+PKG_MD5SUM:=d5ac8329633590ed072a6b7ecccacf0b
+PKG_CAT:=bzcat
+
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/batman
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +kmod-tun
+  TITLE:=B.A.T.M.A.N. Better Approach To Mobile Ad-hoc Networking
+  URL:=https://www.open-mesh.net/
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               $(TARGET_CONFIGURE_OPTS) \
+               NODEBUG=1 \
+               OFLAGS="$(TARGET_CFLAGS)" \
+               OS="linux" \
+               INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+               STRIP="/bin/true" \
+               batmand install
+endef
+
+define Package/batman/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/batmand $(1)/usr/sbin/
+       $(CP) -a ./files/* $(1)/
+       chmod -R 755 $(1)/etc/init.d/batman
+endef
+
+
+$(eval $(call BuildPackage,batman))
diff --git a/files/etc/config/batman b/files/etc/config/batman
new file mode 100644 (file)
index 0000000..15587bc
--- /dev/null
@@ -0,0 +1,8 @@
+config batman general
+       option interface                ath0
+       option announce                 
+       option gateway_class            
+       option originator_interval
+       option preferred_gateway        
+       option routing_class
+       option visualisation_srv        
diff --git a/files/etc/init.d/batman b/files/etc/init.d/batman
new file mode 100644 (file)
index 0000000..c12ebf1
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh /etc/rc.common
+START=100
+. /lib/config/uci.sh
+uci_load batman
+start () {
+       interface=$(uci get batman.general.interface)
+       if [ "$interface" = "" ]; then
+               echo $1 Error, you must specify at least a network interface
+               exit
+       fi
+       announce=$(uci get batman.general.announce)
+       gateway_class=$(uci get batman.general.gateway_class)
+       originator_interval=$(uci get batman.general.originator_interval)
+       preferred_gateway=$(uci get batman.general.preferred_gateway)
+       routing_class=$(uci get batman.general.routing_class)
+       visualisation_srv=$(uci get batman.general.visualisation_srv)
+       batman_args=""
+
+       if [ $announce ]; then
+               batman_args=${batman_args}'-a '$announce' '
+       fi
+
+       if [ $gateway_class ]; then
+               batman_args=${batman_args}'-g '$gateway_class' '
+       fi
+
+       if [ $originator_interval ]; then
+               batman_args=${batman_args}'-o '$originator_interval' '
+       fi
+
+       if [ $preferred_gateway ]; then
+               batman_args=${batman_args}'-p '$preferred_gateway' '
+       fi
+
+       if [ $routing_class ]; then
+               batman_args=${batman_args}'-r '$routing_class' '
+       fi
+               
+       if [ $visualisation_srv ]; then
+               batman_args=${batman_args}'-v '$visualisation_srv' '
+       fi
+
+       batman_args=${batman_args}$interface
+       batmand $batman_args >/dev/null 2>&1
+}
+
+restart () {
+       $0 stop
+       sleep 3
+       $0 start
+}
+        
+stop () {
+       killall batmand
+}
diff --git a/patches/100-makefile.patch b/patches/100-makefile.patch
new file mode 100644 (file)
index 0000000..b96541f
--- /dev/null
@@ -0,0 +1,18 @@
+--- batman-III-0.2.0a.old/Makefile     2007-02-28 15:41:11.000000000 +0100
++++ batman-III-0.2.0a/Makefile 2007-02-28 15:42:02.000000000 +0100
+@@ -27,6 +27,7 @@
+ CFLAGS =              -Wall -O0 -g3
+ LDFLAGS =             -lpthread
+ #LDFLAGS =            -static -lpthread
++SBINDIR =      $(INSTALL_PREFIX)/usr/sbin
+ UNAME=$(shell uname)
+@@ -67,3 +68,7 @@
+ clean:
+               rm -f batmand batmand-mips* *.o *~
++
++install:
++              mkdir -p $(SBINDIR)
++              install -m 755 batmand $(SBINDIR)