From: jow Date: Thu, 9 Jun 2011 00:34:46 +0000 (+0000) Subject: [packages] stun: fix init script (#9528) X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=0f00e69aefce16f24198d3a4fad9c7558e514b34;p=packages.git [packages] stun: fix init script (#9528) git-svn-id: svn://svn.openwrt.org/openwrt/packages@27141 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/net/stun/Makefile b/net/stun/Makefile index 34f7df5ff..b0ac419df 100644 --- a/net/stun/Makefile +++ b/net/stun/Makefile @@ -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 diff --git a/net/stun/files/stund.init b/net/stun/files/stund.init index 296056745..177ae58f5 100644 --- a/net/stun/files/stund.init +++ b/net/stun/files/stund.init @@ -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 }