tinyproxy: convert to procd
The path changed since274506803a
Fixed. Also took the time to convert to procd. Signed-off-by: Rosen Penev <rosenp@gmail.com> (cherry picked from commitc14ba8bd77
)
This commit is contained in:
parent
39ce334617
commit
089699b1ee
2 changed files with 71 additions and 69 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=tinyproxy
|
||||
PKG_VERSION:=1.10.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://github.com/tinyproxy/tinyproxy/releases/download/$(PKG_VERSION)
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
# Copyright (C) 2008-2011 OpenWrt.org
|
||||
|
||||
START=50
|
||||
USE_PROCD=1
|
||||
|
||||
CFGFILE=/var/etc/tinyproxy.conf
|
||||
PROG=/usr/bin/tinyproxy
|
||||
|
||||
section_enabled() {
|
||||
local enabled
|
||||
|
@ -11,74 +13,6 @@ section_enabled() {
|
|||
[ "$enabled" -gt 0 ]
|
||||
}
|
||||
|
||||
start() {
|
||||
config_load 'tinyproxy'
|
||||
config_foreach start_proxy 'tinyproxy'
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/sbin/tinyproxy
|
||||
}
|
||||
|
||||
start_proxy() {
|
||||
section_enabled "$1" || return 1
|
||||
|
||||
mkdir -p /var/etc
|
||||
chmod 0755 /var/etc
|
||||
{
|
||||
echo '### AUTOGENERATED CONFIGURATION'
|
||||
echo '### DO NOT EDIT'
|
||||
echo '### SEE /etc/config/tinyproxy INSTEAD'
|
||||
echo ''
|
||||
|
||||
proxy_atom "$1" User
|
||||
proxy_atom "$1" Group
|
||||
proxy_atom "$1" Port 8888
|
||||
proxy_atom "$1" Listen
|
||||
proxy_atom "$1" Bind
|
||||
proxy_atom "$1" Timeout
|
||||
|
||||
proxy_string "$1" ErrorFile_400 "ErrorFile 400"
|
||||
proxy_string "$1" ErrorFile_403 "ErrorFile 403"
|
||||
proxy_string "$1" ErrorFile_404 "ErrorFile 404"
|
||||
proxy_string "$1" ErrorFile_408 "ErrorFile 408"
|
||||
proxy_string "$1" ErrorFile_503 "ErrorFile 503"
|
||||
|
||||
proxy_string "$1" DefaultErrorFile
|
||||
proxy_string "$1" StatHost StatHost 127.0.0.1
|
||||
proxy_string "$1" StatFile
|
||||
proxy_string "$1" LogFile
|
||||
|
||||
proxy_flag "$1" Syslog
|
||||
|
||||
proxy_atom "$1" LogLevel
|
||||
|
||||
proxy_flag "$1" XTinyproxy
|
||||
|
||||
proxy_atom "$1" MaxClients
|
||||
proxy_atom "$1" MinSpareServers
|
||||
proxy_atom "$1" MaxSpareServers
|
||||
proxy_atom "$1" StartServers
|
||||
proxy_atom "$1" MaxRequestsPerChild
|
||||
proxy_list "$1" Allow
|
||||
|
||||
proxy_string "$1" ViaProxyName
|
||||
proxy_string "$1" Filter
|
||||
|
||||
proxy_flag "$1" FilterURLs
|
||||
proxy_flag "$1" FilterExtended
|
||||
proxy_flag "$1" FilterCaseSensitive
|
||||
proxy_flag "$1" FilterDefaultDeny Yes No
|
||||
|
||||
proxy_list "$1" Anonymous '"'
|
||||
proxy_list "$1" ConnectPort
|
||||
|
||||
config_foreach write_upstream upstream
|
||||
} > "$CFGFILE"
|
||||
|
||||
service_start /usr/sbin/tinyproxy -c "$CFGFILE"
|
||||
}
|
||||
|
||||
write_upstream() {
|
||||
local type
|
||||
local via
|
||||
|
@ -144,3 +78,71 @@ proxy_list() {
|
|||
done
|
||||
}
|
||||
}
|
||||
|
||||
start_proxy() {
|
||||
section_enabled "$1" || return 1
|
||||
|
||||
mkdir -p /var/etc
|
||||
chmod 0755 /var/etc
|
||||
{
|
||||
echo '### AUTOGENERATED CONFIGURATION'
|
||||
echo '### DO NOT EDIT'
|
||||
echo '### SEE /etc/config/tinyproxy INSTEAD'
|
||||
echo ''
|
||||
|
||||
proxy_atom "$1" User
|
||||
proxy_atom "$1" Group
|
||||
proxy_atom "$1" Port 8888
|
||||
proxy_atom "$1" Listen
|
||||
proxy_atom "$1" Bind
|
||||
proxy_atom "$1" Timeout
|
||||
|
||||
proxy_string "$1" ErrorFile_400 "ErrorFile 400"
|
||||
proxy_string "$1" ErrorFile_403 "ErrorFile 403"
|
||||
proxy_string "$1" ErrorFile_404 "ErrorFile 404"
|
||||
proxy_string "$1" ErrorFile_408 "ErrorFile 408"
|
||||
proxy_string "$1" ErrorFile_503 "ErrorFile 503"
|
||||
|
||||
proxy_string "$1" DefaultErrorFile
|
||||
proxy_string "$1" StatHost StatHost 127.0.0.1
|
||||
proxy_string "$1" StatFile
|
||||
proxy_string "$1" LogFile
|
||||
|
||||
proxy_flag "$1" Syslog
|
||||
|
||||
proxy_atom "$1" LogLevel
|
||||
|
||||
proxy_flag "$1" XTinyproxy
|
||||
|
||||
proxy_atom "$1" MaxClients
|
||||
proxy_atom "$1" MinSpareServers
|
||||
proxy_atom "$1" MaxSpareServers
|
||||
proxy_atom "$1" StartServers
|
||||
proxy_atom "$1" MaxRequestsPerChild
|
||||
proxy_list "$1" Allow
|
||||
|
||||
proxy_string "$1" ViaProxyName
|
||||
proxy_string "$1" Filter
|
||||
|
||||
proxy_flag "$1" FilterURLs
|
||||
proxy_flag "$1" FilterExtended
|
||||
proxy_flag "$1" FilterCaseSensitive
|
||||
proxy_flag "$1" FilterDefaultDeny Yes No
|
||||
|
||||
proxy_list "$1" Anonymous '"'
|
||||
proxy_list "$1" ConnectPort
|
||||
|
||||
config_foreach write_upstream upstream
|
||||
} > "$CFGFILE"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -c "$CFGFILE"
|
||||
procd_append_param command -d
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load 'tinyproxy'
|
||||
config_foreach start_proxy 'tinyproxy'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue