packages/parprouted: use uci config

git-svn-id: svn://svn.openwrt.org/openwrt/packages@29213 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-17 10:47:19 +00:00
parent a3b544664f
commit 25a812b377
4 changed files with 52 additions and 11 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=parprouted
PKG_VERSION:=0.64
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.hazard.maks.net/parprouted/
@ -43,13 +43,17 @@ define Build/Compile
)
endef
define Package/parprouted/install
define Package/parprouted/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/parprouted $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/default
$(INSTALL_BIN) ./files/parprouted.default $(1)/etc/default/parprouted
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) ./files/parprouted.config $(1)/etc/config/parprouted
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/parprouted.init $(1)/etc/init.d/parprouted
endef
define Package/parprouted/conffiles
/etc/config/parprouted
endef
$(eval $(call BuildPackage,parprouted))

View File

@ -0,0 +1,11 @@
package 'parprouted'
config 'parprouted'
option enabled 0
# make all ARP entries to be permanent
option permanent 0
# list interfaces to do bridging on
list interfaces 'lan'
list interfaces 'wan'

View File

@ -1 +0,0 @@
OPTIONS="$lan_ifname $wifi_ifname"

View File

@ -3,15 +3,42 @@
START=50
PROG="parprouted"
COMMAND="/usr/sbin/$PROG"
DEFAULT="/etc/default/$PROG"
section_enabled() {
local enabled
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
append_interface() {
local name="$1"
local interface
config_get interface "$name" 'ifname' "$name"
append args "$interface"
}
start_instance() {
local section="$1"
local permanent
local interfaces
local args=""
section_enabled "$section" || return 1
config_get_bool permanent "$section" 'permanent' 0
[ $permanent -eq 0 ] || append args "-p"
config_list_foreach "$section" 'interfaces' append_interface
service_start /usr/sbin/parprouted $args
}
start() {
[ -f $DEFAULT ] && . $DEFAULT
service_start $COMMAND $OPTIONS
include /lib/network
scan_interfaces
config_load 'parprouted'
config_foreach start_instance 'parprouted'
}
stop() {
service_stop $COMMAND
service_stop /usr/sbin/parprouted
}