Browse Source

net/polipo: import 1.1.1 from packages

Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info>
lilik-openwrt-22.03
Gabriel Kerneis 11 years ago
parent
commit
a942fa7acb
3 changed files with 251 additions and 0 deletions
  1. +59
    -0
      net/polipo/Makefile
  2. +42
    -0
      net/polipo/files/polipo.config
  3. +150
    -0
      net/polipo/files/polipo.init

+ 59
- 0
net/polipo/Makefile View File

@ -0,0 +1,59 @@
#
# Copyright (C) 2007-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=polipo
PKG_VERSION:=1.1.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.pps.jussieu.fr/~jch/software/files/$(PKG_NAME)/
PKG_MD5SUM:=86939e331e656f638271f578b6e3f893
include $(INCLUDE_DIR)/package.mk
define Package/polipo
SUBMENU:=Web Servers/Proxies
SECTION:=net
CATEGORY:=Network
TITLE:=A caching web proxy
URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/
MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
endef
define Package/polipo/description
Polipo is a small and fast caching web proxy (a web cache, an HTTP proxy,
a proxy server). While Polipo was designed to be used by one person or a
small group of people, there is nothing that prevents it from being used
by a larger group.
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
polipo
endef
define Package/polipo/conffiles
/etc/config/polipo
/etc/polipo/config
endef
define Package/polipo/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/polipo $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/polipo
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config.sample $(1)/etc/polipo/config
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/polipo.config $(1)/etc/config/polipo
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/polipo.init $(1)/etc/init.d/polipo
endef
$(eval $(call BuildPackage,polipo))

+ 42
- 0
net/polipo/files/polipo.config View File

@ -0,0 +1,42 @@
# polipo daemon configuration
config 'polipo' 'daemon'
# daemonise polipo (fork in background)
option 'daemonise' '1'
# where polipo will store its process pid
option 'pidFile' '/var/run/polipo.pid'
config 'polipo' 'general'
option 'enabled' '1'
# adress on which polipo will listen, 0.0.0.0 means all addresses
option 'proxyAddress' '0.0.0.0'
# port on which polipo will listen, default is 8123
#option 'proxyPort' '8123'
# list of allowed clients to connect
list 'allowedClients' '192.168.1.0/24'
#list 'allowedClients' '127.0.0.1'
#list 'allowedClients' '192.168.2.1'
# how much RAM memory should Polipo use (in bytes).
option 'chunkHighMark' '1048576'
# enable disk cache index and serverlist of integrated polipo web interface
#option 'disableIndexing' '0'
#option 'disableServersList' '0'
# disable loging to syslog
option 'logSyslog' '0'
# set log file location (disabled when not set)
#option 'logFile' '/mnt/usbdrive/polipo/log'
config 'polipo' 'cache'
# disk cache location, you should always use external storage device
# (disabled when not set)
#option 'diskCacheRoot' '/mnt/usbdrive-p2/polipo/cache'
# disk cache cleanup settings
#option 'diskCacheUnlinkTime' '20d'
#option 'diskCacheTruncateTime' '5d'
#option 'diskCacheTruncateSize' '3145728'
# set to 1 if proxy is used by multiple users
#option 'cacheIsShared' '1'
config 'polipo' 'pmm'
# poor man's multiplexing semgnet size to fetch
#option 'pmmSize' '8192'

+ 150
- 0
net/polipo/files/polipo.init View File

@ -0,0 +1,150 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org
START=99
CFGFILE=/var/etc/polipo.conf
start() {
config_load 'polipo'
config_get_bool enabled "general" 'enabled' '0'
[ $enabled -gt 0 ] || return 1
mkdir -m 0755 -p /var/etc/
echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
echo '### DO NOT EDIT' >> $CFGFILE
echo '### SEE /etc/config/polipo INSTEAD' >> $CFGFILE
echo '' >> $CFGFILE
config_foreach polipo_config 'polipo'
# handle values that are disabled when not defined or empty
echo "### VALUES THAT ARE DISABLED WHEN EMPTY" >> $CFGFILE
polipo_atom "cache" "diskCacheRoot" '"' "1" >> $CFGFILE
polipo_atom "general" "logFile" '"' "1" >> $CFGFILE
polipo_atom "general" "localDocumentRoot" '"' "1" >> $CFGFILE
service_start /usr/sbin/polipo -c "$CFGFILE"
}
stop() {
service_stop /usr/sbin/polipo -c "$CFGFILE"
}
polipo_config() {
echo "### SECTION $1" >> $CFGFILE
string_options='authCredentials authRealm dnsNameServer forbiddenFile
forbiddenUrl logFacility pidFile parentAuthCredentials parentProxy
proxyAddress proxyName redirector socksParentProxy socksProxyType
socksUserName uncachableFile'
number_options='bigBufferSize chunkCriticalMark chunkHighMark chunkLowMark
diskCacheDirectoryPermissions diskCacheFilePermissions
diskCacheTruncateSize diskCacheWriteoutOnClose forbiddenRedirectCode
logFilePermissions logLevel maxDiskCacheEntrySize maxDiskEntries
maxObjectsWhenIdle maxPipelineTrain maxSideBuffering maxWriteoutWhenIdle
objectHashTableSize objectHighMark pmmFirstSize pmmSize proxyPort
publicObjectLowMark redirectorRedirectCode replyUnpipelineSize
serverMaxSlots serverSlots serverSlots1 maxAgeFraction'
time_options='clientTimeout diskCacheTruncateTime diskCacheUnlinkTime
dnsGethostbynameTtl dnsMaxTimeout dnsNegativeTtl idleTime maxAge
maxConnectionAge maxConnectionRequests maxExpiresAge maxNoModifiedAge
replyUnpipelineTime serverExpireTime serverIdleTimeout serverTimeout
smallRequestTime'
multistate_options='censorReferer dnsQueryIPv6 dnsUseGethostbyname
dontTrustVaryETag expectContinue pipelineAdditionalRequests
useTemporarySourceAddress relaxTransparency'
boolean_options='cacheIsShared daemonise disableConfiguration disableIndexing
disableLocalInterface disableProxy disableServersList disableVia
dontCacheCookies dontCacheRedirects logSyslog mindlesslyCacheVary
preciseExpiry proxyOffline scrubLogs laxHttpParser'
string_list_options='allowedClients censoredHeaders'
number_list_options='allowedPorts tunnelAllowedPorts'
for option in $string_options; do
polipo_atom "$1" "$option" '"' >> $CFGFILE
done
for option in $number_options; do
polipo_atom "$1" "$option" >> $CFGFILE
done
for option in $time_options; do
polipo_atom "$1" "$option" >> $CFGFILE
done
for option in $multistate_options; do
polipo_atom "$1" "$option" >> $CFGFILE
done
for option in $boolean_options; do
polipo_boolean "$1" "$option" >> $CFGFILE
done
for option in $string_list_options; do
polipo_list "$1" "$option" '"' >> $CFGFILE
done
for option in $number_list_options; do
polipo_list "$1" "$option" >> $CFGFILE
done
}
polipo_atom() {
local SECTION=$1
local OPTION=$2
local QUOTE=$3
local EMPTY_DISABLED=${4:-0}
config_get _value "$SECTION" "$OPTION"
[ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && {
echo "$OPTION = ${QUOTE}${_value}${QUOTE}"
}
}
polipo_boolean() {
local SECTION=$1
local OPTION=$2
config_get_bool _value "$SECTION" "$OPTION"
[ -n "$_value" ] && {
[ "$_value" -eq "1" ] && _value="true" || _value="false"
echo "$OPTION = $_value"
}
}
polipo_list() {
local SECTION=$1
local OPTION=$2
local QUOTE=$3
config_get _value "$SECTION" "$OPTION"
[ "$SECTION" = general ] && [ "$OPTION" = allowedClients ] && {
case "$_value" in
*127.0.0.1*) : ;;
*) _value="127.0.0.1 $_value" ;;
esac
}
[ -n "$_value" ] && {
echo -n "$OPTION = "
local FIRST=1
for entry in $_value; do
[ "$FIRST" -ne "1" ] && echo -n ", " || FIRST=0
echo -n "${QUOTE}${entry}${QUOTE}"
done
echo ''
}
}

Loading…
Cancel
Save