Merge branch 'bmxd'
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 18 Apr 2013 16:51:24 +0000 (18:51 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 18 Apr 2013 16:51:24 +0000 (18:51 +0200)
bmxd/Makefile [new file with mode: 0644]
bmxd/files/etc/config/bmxd [new file with mode: 0644]
bmxd/files/etc/init.d/bmxd [new file with mode: 0644]

diff --git a/bmxd/Makefile b/bmxd/Makefile
new file mode 100644 (file)
index 0000000..5dfd7f9
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2008 Freifunk Leipzig
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bmxd
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/axn/bmxd.git
+PKG_REV:=9c1d12b554dccd2efde249f5e44a7d4de59ce1a8
+PKG_VERSION:=r2012011001
+#PKG_RELEASE:=1
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+
+PKG_EXTRA_CFLAGS:=-DNODEBUGALL
+
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bmxd/Default
+  URL:=http://www.bmx6.net/
+  MAINTAINER:=Axel Neumann <neumann@cgws.de>
+endef
+
+define Package/bmxd
+$(call Package/bmxd/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  DEPENDS:=+kmod-tun
+  TITLE:=B.a.t.M.a.n. eXperimental (BMX) layer 3 routing daemon
+endef
+
+define Package/bmxd/conffiles
+/etc/config/bmxd
+endef
+
+
+define Package/bmxd/description
+B.a.t.M.a.n. eXperimental (BMX) layer 3 routing daemon
+endef
+
+MAKE_ARGS += \
+       EXTRA_CFLAGS="$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)" \
+       CCFLAGS="$(TARGET_CFLAGS)" \
+       OFLAGS="$(TARGET_CFLAGS)" \
+       REVISION="$(PKG_REV)" \
+       CC="$(TARGET_CC)" \
+       NODEBUG=1 \
+       UNAME="Linux" \
+       INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+       STRIP="/bin/true" \
+       bmxd install
+
+define Build/Compile
+       mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
+       $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
+endef
+
+define Package/bmxd/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bmxd $(1)/usr/sbin/bmxd
+       $(INSTALL_BIN) ./files/etc/init.d/bmxd $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/etc/config/bmxd $(1)/etc/config
+endef
+
+$(eval $(call BuildPackage,bmxd))
diff --git a/bmxd/files/etc/config/bmxd b/bmxd/files/etc/config/bmxd
new file mode 100644 (file)
index 0000000..c8619e9
--- /dev/null
@@ -0,0 +1,9 @@
+config bmxd general
+       option interface                'ath0'
+#      option announce                 
+#      option gateway_class            
+#      option originator_interval      
+#      option preferred_gateway        
+#      option routing_class            
+#      option visualisation_srv        
+#      option misc                     'base-port=14305'       
diff --git a/bmxd/files/etc/init.d/bmxd b/bmxd/files/etc/init.d/bmxd
new file mode 100644 (file)
index 0000000..d23b4c8
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh /etc/rc.common
+START=91
+. /lib/config/uci.sh
+uci_load bmxd
+start () {
+       interface="$(uci get bmxd.general.interface)"
+       if [ "$interface" = "" ]; then
+               echo $1 Error, you must specify at least a network interface
+               exit
+       fi
+       announce=$(uci get bmxd.general.announce)
+       gateway_class=$(uci get bmxd.general.gateway_class)
+       originator_interval=$(uci get bmxd.general.originator_interval)
+       preferred_gateway=$(uci get bmxd.general.preferred_gateway)
+       routing_class=$(uci get bmxd.general.routing_class)
+       visualisation_srv=$(uci get bmxd.general.visualisation_srv)
+       misc="$(uci get bmxd.general.misc)"
+       bmx_args=""
+
+       if [ $announce ]; then
+               bmx_args=${bmx_args}'-a '$announce' '
+       fi
+
+       if [ $gateway_class ]; then
+               bmx_args=${bmx_args}'-g '$gateway_class' '
+       fi
+
+       if [ $originator_interval ]; then
+               bmx_args=${bmx_args}'-o '$originator_interval' '
+       fi
+
+       if [ $preferred_gateway ]; then
+               bmx_args=${bmx_args}'-p '$preferred_gateway' '
+       fi
+
+       if [ $routing_class ]; then
+               bmx_args=${bmx_args}'-r '$routing_class' '
+       fi
+               
+       if [ $visualisation_srv ]; then
+               bmx_args=${bmx_args}'-s '$visualisation_srv' '
+       fi
+       
+
+       bmx_args="$misc ${bmx_args} $interface"
+       bmxd $bmx_args >/dev/null 2>&1
+}
+
+stop () {
+       killall bmxd
+}