#
-# 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.
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
$(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
#!/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
}