packages/ptunnel: use new service functions
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29098 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ac37eb2674
commit
ad04b648d1
@ -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.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=ptunnel
|
PKG_NAME:=ptunnel
|
||||||
PKG_VERSION:=0.71
|
PKG_VERSION:=0.71
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=PingTunnel-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=PingTunnel-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://www.cs.uit.no/~daniels/PingTunnel
|
PKG_SOURCE_URL:=http://www.cs.uit.no/~daniels/PingTunnel
|
||||||
@ -52,7 +52,7 @@ endef
|
|||||||
|
|
||||||
define Package/ptunnel/install
|
define Package/ptunnel/install
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(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_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/ptunnel.init $(1)/etc/init.d/ptunnel
|
$(INSTALL_BIN) ./files/ptunnel.init $(1)/etc/init.d/ptunnel
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
@ -1,40 +1,32 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2007-2009 OpenWrt.org
|
# Copyright (C) 2007-2011 OpenWrt.org
|
||||||
|
|
||||||
START=70
|
START=70
|
||||||
BIN=ptunnel
|
|
||||||
PIDCOUNT=0
|
|
||||||
|
|
||||||
start() {
|
start_instance() {
|
||||||
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() {
|
|
||||||
local section="$1"
|
local section="$1"
|
||||||
|
|
||||||
config_get interface "$section" interface
|
config_get interface "$section" interface
|
||||||
config_get ifname "$interface" ifname
|
config_get ifname "$interface" ifname
|
||||||
|
|
||||||
[ -z "$ifname" ] && {
|
[ -z "$ifname" ] && {
|
||||||
echo "Error: Interface '$interface' not found" 1>&2
|
echo "${initscript}: Error: Interface '$interface' not found" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
PIDCOUNT="$(( ${PIDCOUNT} + 1))"
|
SERVICE_PID_FILE="/var/run/ptunnel.$ifname.pid"
|
||||||
${BIN} -c "$ifname" -daemon /var/run/ptunnel."$PIDCOUNT".pid> /dev/null
|
service_start /usr/sbin/ptunnel -c "$ifname" -daemon $SERVICE_PID_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
include /lib/network
|
||||||
|
scan_interfaces
|
||||||
|
|
||||||
|
config_load 'ptunnel'
|
||||||
|
config_foreach start_instance 'ptunnel'
|
||||||
|
iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
local pidfile
|
service_stop /usr/sbin/ptunnel
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user