From: Jo-Philipp Wich Date: Sun, 5 Feb 2012 15:57:49 +0000 (+0000) Subject: [packages_10.03.2] ptunnel: merge r29098, r29228 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=2abb63377f1c735a3a28a4f68711dc680bf0de79 [packages_10.03.2] ptunnel: merge r29098, r29228 SVN-Revision: 30244 --- diff --git a/net/ptunnel/Makefile b/net/ptunnel/Makefile index 54b8b328a1..52e9558582 100644 --- a/net/ptunnel/Makefile +++ b/net/ptunnel/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2009 OpenWrt.org +# Copyright (C) 2006-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:=ptunnel PKG_VERSION:=0.71 -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_SOURCE:=PingTunnel-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.cs.uit.no/~daniels/PingTunnel @@ -52,11 +52,11 @@ endef define Package/ptunnel/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ptunnel $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ptunnel $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/ptunnel.init $(1)/etc/init.d/ptunnel $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_CONF) ./files/ptunnel.conf $(1)/etc/config/ptunnel + $(INSTALL_CONF) ./files/ptunnel.config $(1)/etc/config/ptunnel endef $(eval $(call BuildPackage,ptunnel)) diff --git a/net/ptunnel/files/ptunnel.conf b/net/ptunnel/files/ptunnel.conf deleted file mode 100644 index bfc74959e7..0000000000 --- a/net/ptunnel/files/ptunnel.conf +++ /dev/null @@ -1,2 +0,0 @@ -config ptunnel - option interface 'lan' diff --git a/net/ptunnel/files/ptunnel.config b/net/ptunnel/files/ptunnel.config new file mode 100644 index 0000000000..bfc74959e7 --- /dev/null +++ b/net/ptunnel/files/ptunnel.config @@ -0,0 +1,2 @@ +config ptunnel + option interface 'lan' diff --git a/net/ptunnel/files/ptunnel.init b/net/ptunnel/files/ptunnel.init index 99252d500d..9524909b01 100644 --- a/net/ptunnel/files/ptunnel.init +++ b/net/ptunnel/files/ptunnel.init @@ -1,40 +1,32 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2007-2009 OpenWrt.org +# Copyright (C) 2007-2011 OpenWrt.org START=70 -BIN=ptunnel -PIDCOUNT=0 -start() { - include /lib/network - scan_interfaces - - config_load ptunnel - config_foreach start_ptunnel ptunnel - iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null -} - -start_ptunnel() { +start_instance() { local section="$1" config_get interface "$section" interface config_get ifname "$interface" ifname [ -z "$ifname" ] && { - echo "Error: Interface '$interface' not found" 1>&2 + echo "${initscript}: Error: Interface '$interface' not found" 1>&2 return 1 } - PIDCOUNT="$(( ${PIDCOUNT} + 1))" - ${BIN} -c "$ifname" -daemon /var/run/ptunnel."$PIDCOUNT".pid> /dev/null + SERVICE_PID_FILE="/var/run/ptunnel.$ifname.pid" + service_start /usr/sbin/ptunnel -c "$ifname" -daemon $SERVICE_PID_FILE } -stop() { - local pidfile +start() { + include /lib/network + scan_interfaces - for pidfile in `ls /var/run/${BIN}.*.pid` - do - start-stop-daemon -K -s KILL -p "${pidfile}" -n "${BIN}" >/dev/null - rm -f "${pidfile}" - done + config_load 'ptunnel' + config_foreach start_instance 'ptunnel' + iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null +} + +stop() { + service_stop /usr/sbin/ptunnel }