Browse Source

net/polipo: import 1.1.1 from packages

Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info>
Gabriel Kerneis 10 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 @@
1
+#
2
+# Copyright (C) 2007-2011 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=polipo
11
+PKG_VERSION:=1.1.1
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=http://www.pps.jussieu.fr/~jch/software/files/$(PKG_NAME)/
16
+PKG_MD5SUM:=86939e331e656f638271f578b6e3f893
17
+
18
+include $(INCLUDE_DIR)/package.mk
19
+
20
+define Package/polipo
21
+  SUBMENU:=Web Servers/Proxies
22
+  SECTION:=net
23
+  CATEGORY:=Network
24
+  TITLE:=A caching web proxy
25
+  URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/
26
+  MAINTAINER:=Gabriel Kerneis <gabriel@kerneis.info>
27
+endef
28
+
29
+define Package/polipo/description
30
+ Polipo is a small and fast caching web proxy (a web cache, an HTTP proxy,
31
+ a proxy server). While Polipo was designed to be used by one person or a
32
+ small group of people, there is nothing that prevents it from being used
33
+ by a larger group.
34
+endef
35
+
36
+define Build/Compile
37
+	$(MAKE) -C $(PKG_BUILD_DIR) \
38
+		CC="$(TARGET_CC)" \
39
+		CFLAGS="$(TARGET_CFLAGS)" \
40
+		polipo
41
+endef
42
+
43
+define Package/polipo/conffiles
44
+/etc/config/polipo
45
+/etc/polipo/config
46
+endef
47
+
48
+define Package/polipo/install
49
+	$(INSTALL_DIR) $(1)/usr/sbin
50
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/polipo $(1)/usr/sbin/
51
+	$(INSTALL_DIR) $(1)/etc/polipo
52
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/config.sample $(1)/etc/polipo/config
53
+	$(INSTALL_DIR) $(1)/etc/config
54
+	$(INSTALL_DATA) ./files/polipo.config $(1)/etc/config/polipo
55
+	$(INSTALL_DIR) $(1)/etc/init.d
56
+	$(INSTALL_BIN) ./files/polipo.init $(1)/etc/init.d/polipo
57
+endef
58
+
59
+$(eval $(call BuildPackage,polipo))

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

@@ -0,0 +1,42 @@
1
+# polipo daemon configuration
2
+config 'polipo' 'daemon'
3
+	# daemonise polipo (fork in background)
4
+	option 'daemonise' '1'
5
+	# where polipo will store its process pid
6
+	option 'pidFile' '/var/run/polipo.pid'
7
+
8
+config 'polipo' 'general'
9
+	option 'enabled' '1'
10
+	# adress on which polipo will listen, 0.0.0.0 means all addresses
11
+	option 'proxyAddress' '0.0.0.0'
12
+	# port on which polipo will listen, default is 8123
13
+	#option 'proxyPort' '8123'
14
+	# list of allowed clients to connect
15
+	list 'allowedClients' '192.168.1.0/24'
16
+	#list 'allowedClients' '127.0.0.1'
17
+	#list 'allowedClients' '192.168.2.1'
18
+	# how much RAM memory should Polipo use (in bytes).
19
+	option 'chunkHighMark' '1048576'
20
+	# enable disk cache index and serverlist of integrated polipo web interface
21
+	#option 'disableIndexing' '0'
22
+	#option 'disableServersList' '0'
23
+	# disable loging to syslog 
24
+	option 'logSyslog' '0'
25
+	# set log file location (disabled when not set)
26
+	#option 'logFile' '/mnt/usbdrive/polipo/log'
27
+
28
+config 'polipo' 'cache'
29
+	# disk cache location, you should always use external storage device
30
+	# (disabled when not set)
31
+	#option 'diskCacheRoot' '/mnt/usbdrive-p2/polipo/cache'
32
+	# disk cache cleanup settings
33
+	#option 'diskCacheUnlinkTime' '20d'
34
+	#option 'diskCacheTruncateTime' '5d'
35
+	#option 'diskCacheTruncateSize' '3145728'
36
+	# set to 1 if proxy is used by multiple users
37
+	#option 'cacheIsShared' '1'
38
+
39
+config 'polipo' 'pmm'
40
+	# poor man's multiplexing semgnet size to fetch
41
+	#option 'pmmSize' '8192'
42
+

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

@@ -0,0 +1,150 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2008-2011 OpenWrt.org
3
+
4
+START=99
5
+
6
+CFGFILE=/var/etc/polipo.conf
7
+
8
+start() {
9
+	config_load 'polipo'
10
+
11
+	config_get_bool enabled "general" 'enabled' '0'
12
+	[ $enabled -gt 0 ] || return 1
13
+
14
+	mkdir -m 0755 -p /var/etc/
15
+	echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
16
+	echo '### DO NOT EDIT' >> $CFGFILE
17
+	echo '### SEE /etc/config/polipo INSTEAD' >> $CFGFILE
18
+	echo '' >> $CFGFILE
19
+
20
+	config_foreach polipo_config 'polipo'
21
+
22
+	# handle values that are disabled when not defined or empty
23
+	echo "### VALUES THAT ARE DISABLED WHEN EMPTY" >> $CFGFILE
24
+	polipo_atom "cache" "diskCacheRoot" '"' "1" >> $CFGFILE
25
+	polipo_atom "general" "logFile" '"' "1" >> $CFGFILE
26
+	polipo_atom "general" "localDocumentRoot" '"' "1" >> $CFGFILE
27
+
28
+	service_start /usr/sbin/polipo -c "$CFGFILE"
29
+}
30
+
31
+stop() {
32
+	service_stop /usr/sbin/polipo -c "$CFGFILE"
33
+}
34
+
35
+polipo_config() {
36
+	echo "### SECTION $1" >> $CFGFILE
37
+
38
+	string_options='authCredentials authRealm dnsNameServer forbiddenFile
39
+		forbiddenUrl logFacility pidFile parentAuthCredentials parentProxy
40
+		proxyAddress proxyName redirector socksParentProxy socksProxyType
41
+		socksUserName uncachableFile'
42
+
43
+	number_options='bigBufferSize chunkCriticalMark chunkHighMark chunkLowMark
44
+		diskCacheDirectoryPermissions diskCacheFilePermissions
45
+		diskCacheTruncateSize diskCacheWriteoutOnClose forbiddenRedirectCode
46
+		logFilePermissions logLevel maxDiskCacheEntrySize maxDiskEntries
47
+		maxObjectsWhenIdle maxPipelineTrain maxSideBuffering maxWriteoutWhenIdle
48
+		objectHashTableSize objectHighMark pmmFirstSize pmmSize proxyPort
49
+		publicObjectLowMark redirectorRedirectCode replyUnpipelineSize
50
+		serverMaxSlots serverSlots serverSlots1 maxAgeFraction'
51
+
52
+	time_options='clientTimeout diskCacheTruncateTime diskCacheUnlinkTime
53
+		dnsGethostbynameTtl dnsMaxTimeout dnsNegativeTtl idleTime maxAge
54
+		maxConnectionAge maxConnectionRequests maxExpiresAge maxNoModifiedAge
55
+		replyUnpipelineTime serverExpireTime serverIdleTimeout serverTimeout
56
+		smallRequestTime'
57
+
58
+	multistate_options='censorReferer dnsQueryIPv6 dnsUseGethostbyname
59
+		dontTrustVaryETag expectContinue pipelineAdditionalRequests
60
+		useTemporarySourceAddress relaxTransparency'
61
+
62
+	boolean_options='cacheIsShared daemonise disableConfiguration disableIndexing
63
+		disableLocalInterface disableProxy disableServersList disableVia
64
+		dontCacheCookies dontCacheRedirects logSyslog mindlesslyCacheVary
65
+		preciseExpiry proxyOffline scrubLogs laxHttpParser'
66
+
67
+	string_list_options='allowedClients censoredHeaders'
68
+
69
+	number_list_options='allowedPorts tunnelAllowedPorts'
70
+
71
+	for option in $string_options; do
72
+		polipo_atom "$1" "$option" '"' >> $CFGFILE
73
+	done
74
+
75
+	for option in $number_options; do
76
+		polipo_atom "$1" "$option" >> $CFGFILE
77
+	done
78
+
79
+	for option in $time_options; do
80
+		polipo_atom "$1" "$option" >> $CFGFILE
81
+	done
82
+	
83
+	for option in $multistate_options; do
84
+		polipo_atom "$1" "$option" >> $CFGFILE
85
+	done
86
+
87
+	for option in $boolean_options; do
88
+		polipo_boolean "$1" "$option" >> $CFGFILE
89
+	done
90
+
91
+	for option in $string_list_options; do
92
+		polipo_list "$1" "$option" '"' >> $CFGFILE
93
+	done
94
+	
95
+	for option in $number_list_options; do
96
+		polipo_list "$1" "$option" >> $CFGFILE
97
+	done
98
+}
99
+
100
+polipo_atom() {
101
+	local SECTION=$1
102
+	local OPTION=$2
103
+	local QUOTE=$3
104
+	local EMPTY_DISABLED=${4:-0}
105
+
106
+	config_get _value "$SECTION" "$OPTION"
107
+	[ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && {
108
+		echo "$OPTION = ${QUOTE}${_value}${QUOTE}"
109
+	}
110
+}
111
+
112
+polipo_boolean() {
113
+	local SECTION=$1
114
+	local OPTION=$2
115
+
116
+	config_get_bool _value "$SECTION" "$OPTION"
117
+	[ -n "$_value" ] && {
118
+		[ "$_value" -eq "1" ] && _value="true" || _value="false"
119
+		echo "$OPTION = $_value"
120
+	}
121
+}
122
+
123
+polipo_list() {
124
+	local SECTION=$1
125
+	local OPTION=$2
126
+	local QUOTE=$3
127
+
128
+	config_get _value "$SECTION" "$OPTION"
129
+	
130
+	[ "$SECTION" = general ] && [ "$OPTION" = allowedClients ] && {
131
+		case "$_value" in
132
+			*127.0.0.1*) : ;;
133
+			*) _value="127.0.0.1 $_value" ;;
134
+		esac
135
+	}
136
+	
137
+	[ -n "$_value" ] && {
138
+		echo -n "$OPTION = "
139
+		
140
+		local FIRST=1
141
+		for entry in $_value; do
142
+			[ "$FIRST" -ne "1" ] && echo -n ", " || FIRST=0
143
+			
144
+			echo -n "${QUOTE}${entry}${QUOTE}"
145
+		done
146
+		
147
+		echo ''
148
+	}
149
+}
150
+