packages/frickin: use uci config
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29216 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
412e6f60f9
commit
cc2421aabe
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=frickin
|
||||
PKG_VERSION:=1.3
|
||||
PKG_RELEASE:=2
|
||||
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))
|
||||
|
13
net/frickin/files/frickin.config
Normal file
13
net/frickin/files/frickin.config
Normal file
@ -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
|
@ -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"
|
@ -6,13 +6,57 @@ START=50
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
|
||||
DEFAULT=/etc/default/frickin
|
||||
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() {
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
service_start /usr/sbin/frickin $OPTIONS
|
||||
include /lib/network
|
||||
scan_interfaces
|
||||
config_load 'frickin'
|
||||
config_foreach start_instance 'frickin'
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/sbin/frickin
|
||||
include /lib/network
|
||||
scan_interfaces
|
||||
config_load 'frickin'
|
||||
config_foreach stop_instance 'frickin'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user