#
-# 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.
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
Translation (NAT).
endef
-define Package/frickin/conffiles
-/etc/default/frickin
-endef
-
define Build/Configure
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
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))
--- /dev/null
+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
+++ /dev/null
-# 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"
#!/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'
}
-