From: jow Date: Sun, 5 Feb 2012 15:13:35 +0000 (+0000) Subject: [packages_10.03.2] frickin: merge r29060, r29216 X-Git-Url: https://git.archive.openwrt.org/?a=commitdiff_plain;h=a867b00390fc30c0a3b8dc55e0d960327b13d163;p=10.03%2Fpackages.git [packages_10.03.2] frickin: merge r29060, r29216 git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_10.03.2@30205 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/net/frickin/Makefile b/net/frickin/Makefile index 2265c4e..c934cdf 100644 --- a/net/frickin/Makefile +++ b/net/frickin/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 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:=frickin PKG_VERSION:=1.3 -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/frickin @@ -31,10 +31,6 @@ define Package/frickin/description Translation (NAT). endef -define Package/frickin/conffiles -/etc/default/frickin -endef - define Build/Configure $(MAKE) -C $(PKG_BUILD_DIR) \ $(TARGET_CONFIGURE_OPTS) \ @@ -43,12 +39,16 @@ define Build/Configure endef define Package/frickin/install - $(INSTALL_DIR) $(1)/etc/default - $(INSTALL_DATA) ./files/frickin.default $(1)/etc/default/frickin + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/frickin.config $(1)/etc/config/frickin $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/frickin.init $(1)/etc/init.d/frickin $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/frickin $(1)/usr/sbin/ endef +define Package/frickin/conffiles +/etc/config/frickin +endef + $(eval $(call BuildPackage,frickin)) diff --git a/net/frickin/files/frickin.config b/net/frickin/files/frickin.config new file mode 100644 index 0000000..32141cd --- /dev/null +++ b/net/frickin/files/frickin.config @@ -0,0 +1,13 @@ +package 'frickin' + +config 'frickin' + option enabled 0 + + # listen on the specified IP address + option listen_ip '192.168.1.1' + + # connect to the specified IP address + option server_ip '192.168.1.253' + + # set the maximum number of simultaneous connections +# option conn_limit 20 diff --git a/net/frickin/files/frickin.default b/net/frickin/files/frickin.default deleted file mode 100644 index 9f55d5b..0000000 --- a/net/frickin/files/frickin.default +++ /dev/null @@ -1,16 +0,0 @@ -# ip address of the server the proxy should connect to -TARGET_IP=192.168.1.2 - -# ip address the proxy should listen to for incoming connections -#LISTEN_IP=192.168.1.1 - -# maximum number of simultaneous connections -#PROXY_CONN_MAX=20 - -# user the proxy should run as -#PROXY_USER=root - -[ -n "$TARGET_IP" ] && OPTIONS="$OPTIONS -s $TARGET_IP" -[ -n "$LISTEN_IP" ] && OPTIONS="$OPTIONS -l $LISTEN_IP" -[ -n "$PROXY_CONN_MAX" ] && OPTIONS="$OPTIONS -c $PROXY_CONN_MAX" -[ -n "$PROXY_USER" ] && OPTIONS="$OPTIONS -u $PROXY_USER" diff --git a/net/frickin/files/frickin.init b/net/frickin/files/frickin.init index c6fbb48..c002513 100644 --- a/net/frickin/files/frickin.init +++ b/net/frickin/files/frickin.init @@ -1,16 +1,62 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2011 OpenWrt.org + START=50 -BIN=frickin -DEFAULT=/etc/default/$BIN -[ -f $DEFAULT ] && . $DEFAULT +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +append_string() { + local var="$1" + local section="$2" + local option="$3" + local val="$4" + local _val + config_get _val "$section" "$option" + [ -n "$_val" ] && append "$var" "$val $_val" +} + +section_enabled() { + local enabled + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +start_instance() { + local section="$1" + local args + + section_enabled "$section" || return 1 + + append_string args "$section" 'listen_ip' '-l' + append_string args "$section" 'server_ip' '-s' + append_string args "$section" 'conn_limit' '-c' + + SERVICE_PID_FILE="/var/run/frickin-${section}.pid" + service_start /usr/sbin/frickin $args +} + +stop_instance() { + local section="$1" + local id + local if + + section_enabled "$section" || return 1 + + SERVICE_PID_FILE="/var/run/frickin-${section}.pid" + service_stop /usr/sbin/frickin +} start() { - $BIN $OPTIONS & + include /lib/network + scan_interfaces + config_load 'frickin' + config_foreach start_instance 'frickin' } stop() { - killall $BIN + include /lib/network + scan_interfaces + config_load 'frickin' + config_foreach stop_instance 'frickin' } -