[packages] stun: fix init script (#9528)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@27141 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2011-06-09 00:34:46 +00:00
parent baa794848a
commit 0f00e69aef
2 changed files with 21 additions and 11 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2008-2009 OpenWrt.org
# Copyright (C) 2008-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=stund
PKG_VERSION:=0.96
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)_Aug13.tgz
PKG_SOURCE_URL:=@SF/stun
@ -68,7 +68,7 @@ define Package/stund/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/server $(1)/usr/sbin/stund
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/stund.init $(1)/etc/init.d/
$(INSTALL_BIN) ./files/stund.init $(1)/etc/init.d/stund
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/stund.config $(1)/etc/config/stund
endef

View File

@ -1,18 +1,28 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2009 OpenWrt.org
# Copyright (C) 2009-2011 OpenWrt.org
START=70
start() {
config_load "6stund"
local pri_ip sec_ip pri_port sec_port
parse_opts() {
local cfg="$1"
config_get pri_ip "$cfg" primaryip
config_get sec_ip "$cfg" secondaryip
config_get pri_port "$cfg" primaryport
config_get sec_port "$cfg" secondaryport
}
config_get PRIMIP primaryip
config_get SECIP secondaryip
config_get PRIMPORT primaryport
config_get SECPORT secondaryport
config_load "stund"
config_foreach parse_opts
/usr/sbin/stund -b -h $PRIMIP -a $SECIP -p $PRIMPORT -o $SECPORT
start-stop-daemon -S -p /var/run/stund.pid -m -b \
-x /usr/sbin/stund -- \
${pri_ip:+-h $pri_ip} ${sec_ip:+-a $sec_ip} \
${pri_port:+-p $pri_port} ${sec_port:+-o $sec_port}
}
stop() {
killall -9 stund
service_kill stund /var/run/stund.pid
rm -f /var/run/stund.pid
}