Merge lp:~racb/squid-deb-proxy/apt_refresh into lp:squid-deb-proxy
- apt_refresh
- Merge into trunk
Proposed by
Robie Basak
Status: | Merged |
---|---|
Approved by: | Michael Vogt |
Approved revision: | 16 |
Merge reported by: | Michael Vogt |
Merged at revision: | not available |
Proposed branch: | lp:~racb/squid-deb-proxy/apt_refresh |
Merge into: | lp:squid-deb-proxy |
Diff against target: |
1529 lines (+1334/-0) (has conflicts) 34 files modified
.bzr-builddeb/default.conf (+2/-0) 30autoproxy (+1/-0) Makefile (+22/-0) README (+19/-0) README.autogenerated (+2/-0) allowed-networks-src.acl (+12/-0) apt-avahi-discover (+12/-0) avahi/Makefile (+10/-0) avahi/README (+2/-0) avahi/find_squid_deb_proxy.c (+232/-0) contrib/squid-deb-proxy.init (+185/-0) debian/changelog (+192/-0) debian/compat (+1/-0) debian/control (+52/-0) debian/copyright (+14/-0) debian/po/POTFILES.in (+1/-0) debian/po/templates.pot (+48/-0) debian/postrm (+12/-0) debian/preinst (+54/-0) debian/rules (+8/-0) debian/squid-deb-proxy-client-udeb.dirs (+1/-0) debian/squid-deb-proxy-client-udeb.install (+1/-0) debian/squid-deb-proxy-client.install (+2/-0) debian/squid-deb-proxy.config (+11/-0) debian/squid-deb-proxy.install (+1/-0) debian/squid-deb-proxy.logrotate (+15/-0) debian/squid-deb-proxy.postinst (+131/-0) debian/squid-deb-proxy.postrm (+11/-0) debian/squid-deb-proxy.templates (+16/-0) debian/squid-deb-proxy.upstart (+105/-0) mirror-dstdomain.acl (+21/-0) squid-deb-proxy.conf (+93/-0) tests/test_acl.sh (+36/-0) udeb/80squid-deb-proxy-client (+9/-0) Conflict adding file .bzr-builddeb. Moved existing file to .bzr-builddeb.moved. Conflict adding file 30autoproxy. Moved existing file to 30autoproxy.moved. Conflict adding file Makefile. Moved existing file to Makefile.moved. Conflict adding file README.autogenerated. Moved existing file to README.autogenerated.moved. Conflict adding file README. Moved existing file to README.moved. Conflict adding file allowed-networks-src.acl. Moved existing file to allowed-networks-src.acl.moved. Conflict adding file apt-avahi-discover. Moved existing file to apt-avahi-discover.moved. Conflict adding file avahi. Moved existing file to avahi.moved. Conflict adding file contrib. Moved existing file to contrib.moved. Conflict adding file debian. Moved existing file to debian.moved. Conflict adding file mirror-dstdomain.acl. Moved existing file to mirror-dstdomain.acl.moved. Conflict adding file squid-deb-proxy.conf. Moved existing file to squid-deb-proxy.conf.moved. Conflict adding file tests. Moved existing file to tests.moved. Conflict adding file udeb. Moved existing file to udeb.moved. |
To merge this branch: | bzr merge lp:~racb/squid-deb-proxy/apt_refresh |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Vogt | Approve | ||
Review via email: mp+100116@code.launchpad.net |
Commit message
Description of the change
Always check to see if Release and Package files have been updated. If they have not changed, they can still be served from the cache, but this way the archive is always consulted. This should eliminate any possibility of apt errors due to the cache being in the middle. Other general apt issues (like squid accessing different mirrors which are skewed, or skew in between fetching Release and Package files, or skew in mirrors between updating Package and Release files, remain).
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory '.bzr-builddeb' |
2 | === renamed directory '.bzr-builddeb' => '.bzr-builddeb.moved' |
3 | === added file '.bzr-builddeb/default.conf' |
4 | --- .bzr-builddeb/default.conf 1970-01-01 00:00:00 +0000 |
5 | +++ .bzr-builddeb/default.conf 2012-03-30 12:19:23 +0000 |
6 | @@ -0,0 +1,2 @@ |
7 | +[BUILDDEB] |
8 | +native = True |
9 | |
10 | === added file '30autoproxy' |
11 | --- 30autoproxy 1970-01-01 00:00:00 +0000 |
12 | +++ 30autoproxy 2012-03-30 12:19:23 +0000 |
13 | @@ -0,0 +1,1 @@ |
14 | +Acquire::http::ProxyAutoDetect "/usr/share/squid-deb-proxy-client/apt-avahi-discover"; |
15 | |
16 | === renamed file '30autoproxy' => '30autoproxy.moved' |
17 | === added file 'Makefile' |
18 | --- Makefile 1970-01-01 00:00:00 +0000 |
19 | +++ Makefile 2012-03-30 12:19:23 +0000 |
20 | @@ -0,0 +1,22 @@ |
21 | +#!/usr/bin/make |
22 | + |
23 | +all: |
24 | + echo "nothing to do" |
25 | + |
26 | +install: |
27 | + # dir |
28 | + install -d -m 755 $(DESTDIR)/etc/squid-deb-proxy |
29 | + install -d -m 755 $(DESTDIR)/etc/squid-deb-proxy/allowed-networks-src.acl.d |
30 | + install -d -m 755 $(DESTDIR)/etc/squid-deb-proxy/mirror-dstdomain.acl.d |
31 | + install -d -m 755 $(DESTDIR)/etc/squid-deb-proxy/pkg-blacklist.d |
32 | + install -d -m 755 $(DESTDIR)/etc/squid-deb-proxy/autogenerated |
33 | + install -m 644 README.autogenerated $(DESTDIR)/etc/squid-deb-proxy/autogenerated |
34 | + install -d -m 755 $(DESTDIR)/etc/apt/apt.conf.d |
35 | + install -d -m 755 $(DESTDIR)/usr/share/squid-deb-proxy-client/ |
36 | + # files |
37 | + install -m 644 squid-deb-proxy.conf $(DESTDIR)/etc/squid-deb-proxy/ |
38 | + install -m 644 allowed-networks-src.acl $(DESTDIR)/etc/squid-deb-proxy/ |
39 | + install -m 644 mirror-dstdomain.acl $(DESTDIR)/etc/squid-deb-proxy/ |
40 | + # client |
41 | + install -m 755 apt-avahi-discover $(DESTDIR)/usr/share/squid-deb-proxy-client/ |
42 | + install -m 644 30autoproxy $(DESTDIR)/etc/apt/apt.conf.d |
43 | |
44 | === renamed file 'Makefile' => 'Makefile.moved' |
45 | === added file 'README' |
46 | --- README 1970-01-01 00:00:00 +0000 |
47 | +++ README 2012-03-30 12:19:23 +0000 |
48 | @@ -0,0 +1,19 @@ |
49 | +This package provides a squid proxy config optimized for caching |
50 | +deb packages on Ubuntu systems. |
51 | + |
52 | +It should work out of the box on port 8000 for most users. |
53 | + |
54 | +It will allow access to .archive.ubuntu.com, archive.canonical.com, |
55 | +extras.ubuntu.com and changelogs.ubuntu.com by default from any |
56 | +private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) network. To |
57 | +customize these settings check /etc/squid-deb-proxy/*.acl |
58 | + |
59 | +To customize the general config, edit the file |
60 | +/etc/squid-deb-proxy/squid-deb-proxy.conf |
61 | + |
62 | +The default config will only allow fetching official Ubuntu packages |
63 | +or official third party packages from archive.canonical.com and |
64 | +extras.ubuntu.com. You can add more repositories either via the |
65 | +whitelist file "mirror-dstdomain.acl" or by tweaking the global |
66 | +configuration "squid-deb-proxy.conf" to allow fetching from any |
67 | +domain (see the http_access and cache options). |
68 | |
69 | === added file 'README.autogenerated' |
70 | --- README.autogenerated 1970-01-01 00:00:00 +0000 |
71 | +++ README.autogenerated 2012-03-30 12:19:23 +0000 |
72 | @@ -0,0 +1,2 @@ |
73 | +This directory contains automatically generated files. |
74 | +Do not edit anything in here. |
75 | |
76 | === renamed file 'README.autogenerated' => 'README.autogenerated.moved' |
77 | === renamed file 'README' => 'README.moved' |
78 | === added file 'allowed-networks-src.acl' |
79 | --- allowed-networks-src.acl 1970-01-01 00:00:00 +0000 |
80 | +++ allowed-networks-src.acl 2012-03-30 12:19:23 +0000 |
81 | @@ -0,0 +1,12 @@ |
82 | +# allowed-networks-src.conf |
83 | +# |
84 | +# network sources that you want to allow access to the cache |
85 | + |
86 | +# private networks |
87 | +10.0.0.0/8 |
88 | +172.16.0.0/12 |
89 | +192.168.0.0/16 |
90 | +127.0.0.1 |
91 | + |
92 | +# additional non-private networks can be added to the directory: |
93 | +# /etc/squid-deb-proxy/allowed-networks-src.acl.d |
94 | |
95 | === renamed file 'allowed-networks-src.acl' => 'allowed-networks-src.acl.moved' |
96 | === added file 'apt-avahi-discover' |
97 | --- apt-avahi-discover 1970-01-01 00:00:00 +0000 |
98 | +++ apt-avahi-discover 2012-03-30 12:19:23 +0000 |
99 | @@ -0,0 +1,12 @@ |
100 | +#!/bin/sh |
101 | +# |
102 | +# use avahi to find a _apt_proxy._tcp provider and return |
103 | +# a http proxy string suitable for apt |
104 | + |
105 | +SERVICE="_apt_proxy._tcp" |
106 | + |
107 | +out=$(avahi-browse -kprt $SERVICE|grep '^=;.*;IPv4;.*'|head -n1) |
108 | +PORT=$(echo "$out" | cut -d ';' -f9) |
109 | +HOST=$(echo "$out" | cut -d ';' -f7) |
110 | +IP=$(avahi-resolve -n4 "$HOST" | cut -f2) |
111 | +echo "http://$IP:$PORT/" |
112 | |
113 | === renamed file 'apt-avahi-discover' => 'apt-avahi-discover.moved' |
114 | === added directory 'avahi' |
115 | === renamed directory 'avahi' => 'avahi.moved' |
116 | === added file 'avahi/Makefile' |
117 | --- avahi/Makefile 1970-01-01 00:00:00 +0000 |
118 | +++ avahi/Makefile 2012-03-30 12:19:23 +0000 |
119 | @@ -0,0 +1,10 @@ |
120 | +CFLAGS := $(shell pkg-config --cflags avahi-core) -g -Wall |
121 | +LDFLAGS := $(shell pkg-config --libs avahi-core) |
122 | + |
123 | +all: find_squid_deb_proxy |
124 | + |
125 | +find_squid_deb_proxy: find_squid_deb_proxy.c |
126 | + $(CC) $(CFLAGS) find_squid_deb_proxy.c -o find_squid_deb_proxy $(LDFLAGS) |
127 | + |
128 | +clean: |
129 | + rm -f find_squid_deb_proxy |
130 | |
131 | === added file 'avahi/README' |
132 | --- avahi/README 1970-01-01 00:00:00 +0000 |
133 | +++ avahi/README 2012-03-30 12:19:23 +0000 |
134 | @@ -0,0 +1,2 @@ |
135 | +This is a pure C implementation of apt-avahi-discover. Its currently |
136 | +not used but might be in the future. |
137 | |
138 | === added file 'avahi/find_squid_deb_proxy.c' |
139 | --- avahi/find_squid_deb_proxy.c 1970-01-01 00:00:00 +0000 |
140 | +++ avahi/find_squid_deb_proxy.c 2012-03-30 12:19:23 +0000 |
141 | @@ -0,0 +1,232 @@ |
142 | +/* $Id$ */ |
143 | + |
144 | +/*** |
145 | + This file is based on an example that is part of avahi, which is copyright: |
146 | + Lennart Poettering <lennart (at) poettering (dot) de> |
147 | + Trent Lloyd <lathiat@bur.st> |
148 | + Sebastien Estienne <sebastien.estienne@gmail.com> |
149 | + Jakub Stachowski |
150 | + James Willcox <snorp@snorp.net> |
151 | + Collabora Ltd. |
152 | + Modifications for eucalyptus-udeb are copyright 2009 Canonical Ltd. |
153 | + Modifications for squid-deb-proxy-udeb are copyright 2011 Canonical Ltd. |
154 | + |
155 | + avahi is free software; you can redistribute it and/or modify it |
156 | + under the terms of the GNU Lesser General Public License as |
157 | + published by the Free Software Foundation; either version 2.1 of the |
158 | + License, or (at your option) any later version. |
159 | + |
160 | + avahi is distributed in the hope that it will be useful, but WITHOUT |
161 | + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
162 | + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
163 | + Public License for more details. |
164 | + |
165 | + You should have received a copy of the GNU Lesser General Public |
166 | + License along with avahi; if not, write to the Free Software |
167 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
168 | + USA. |
169 | +***/ |
170 | + |
171 | +#ifdef HAVE_CONFIG_H |
172 | +#include <config.h> |
173 | +#endif |
174 | + |
175 | +#include <stdio.h> |
176 | +#include <assert.h> |
177 | +#include <stdlib.h> |
178 | +#include <time.h> |
179 | +#include <string.h> |
180 | + |
181 | +#include <avahi-core/core.h> |
182 | +#include <avahi-core/lookup.h> |
183 | +#include <avahi-core/log.h> |
184 | +#include <avahi-common/simple-watch.h> |
185 | +#include <avahi-common/malloc.h> |
186 | +#include <avahi-common/error.h> |
187 | + |
188 | +static AvahiSimplePoll *simple_poll = NULL; |
189 | +static AvahiServer *server = NULL; |
190 | + |
191 | +static int debug = 0; |
192 | + |
193 | +static void quiet_logger(AvahiLogLevel level, const char *txt) { |
194 | +} |
195 | + |
196 | +static void resolve_callback( |
197 | + AvahiSServiceResolver *r, |
198 | + AVAHI_GCC_UNUSED AvahiIfIndex interface, |
199 | + AVAHI_GCC_UNUSED AvahiProtocol protocol, |
200 | + AvahiResolverEvent event, |
201 | + const char *name, |
202 | + const char *type, |
203 | + const char *domain, |
204 | + const char *host_name, |
205 | + const AvahiAddress *address, |
206 | + uint16_t port, |
207 | + AvahiStringList *txt, |
208 | + AvahiLookupResultFlags flags, |
209 | + AVAHI_GCC_UNUSED void* userdata) { |
210 | + |
211 | + assert(r); |
212 | + |
213 | + /* Called whenever a service has been resolved successfully or timed out */ |
214 | + |
215 | + switch (event) { |
216 | + case AVAHI_RESOLVER_FAILURE: |
217 | + if (debug) |
218 | + fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_server_errno(server))); |
219 | + break; |
220 | + |
221 | + case AVAHI_RESOLVER_FOUND: { |
222 | + char *human_address = avahi_malloc0(AVAHI_ADDRESS_STR_MAX); |
223 | + char *key = NULL; |
224 | + AvahiStringList *ipaddr_entry; |
225 | + char *ipaddr_key, *ipaddr_value; |
226 | + |
227 | + ipaddr_entry = avahi_string_list_find(txt, "ipaddr"); |
228 | + if (ipaddr_entry && avahi_string_list_get_pair(ipaddr_entry, &ipaddr_key, &ipaddr_value, NULL) == 0) { |
229 | + key = avahi_strdup_printf("%s:%u", ipaddr_value, port); |
230 | + avahi_free(ipaddr_value); |
231 | + avahi_free(ipaddr_key); |
232 | + } |
233 | + else if (avahi_address_snprint(human_address, AVAHI_ADDRESS_STR_MAX, address)) { |
234 | + if (address->proto == AVAHI_PROTO_INET6) |
235 | + key = avahi_strdup_printf("[%s]:%u", human_address, port); |
236 | + else if (strncmp(human_address, "169.254.169.254", 15) == 0) |
237 | + key = avahi_strdup_printf("%s:%u", name, port); |
238 | + else |
239 | + key = avahi_strdup_printf("%s:%u", human_address, port); |
240 | + } else { |
241 | + if (debug) |
242 | + fprintf(stderr, "(Resolver) failed to resolve %s to IP address/port\n", key); |
243 | + } |
244 | + avahi_free(human_address); |
245 | + |
246 | + printf("http://%s/\n", key); |
247 | + } |
248 | + } |
249 | + |
250 | + avahi_s_service_resolver_free(r); |
251 | +} |
252 | + |
253 | +static void browse_callback( |
254 | + AvahiSServiceBrowser *b, |
255 | + AvahiIfIndex interface, |
256 | + AvahiProtocol protocol, |
257 | + AvahiBrowserEvent event, |
258 | + const char *name, |
259 | + const char *type, |
260 | + const char *domain, |
261 | + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, |
262 | + void* userdata) { |
263 | + |
264 | + AvahiServer *s = userdata; |
265 | + assert(b); |
266 | + |
267 | + /* Called whenever a new services becomes available on the LAN or is removed from the LAN */ |
268 | + |
269 | + switch (event) { |
270 | + |
271 | + case AVAHI_BROWSER_FAILURE: |
272 | + fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_server_errno(server))); |
273 | + avahi_simple_poll_quit(simple_poll); |
274 | + return; |
275 | + |
276 | + case AVAHI_BROWSER_NEW: |
277 | + if (debug) |
278 | + fprintf(stderr, "(Browser) NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain); |
279 | + |
280 | + /* We ignore the returned resolver object. In the callback |
281 | + function we free it. If the server is terminated before |
282 | + the callback function is called the server will free |
283 | + the resolver for us. */ |
284 | + |
285 | + if (!(avahi_s_service_resolver_new(s, interface, protocol, name, type, domain, AVAHI_PROTO_INET, 0, resolve_callback, s))) |
286 | + fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_server_errno(s))); |
287 | + |
288 | + break; |
289 | + |
290 | + case AVAHI_BROWSER_REMOVE: |
291 | + if (debug) |
292 | + fprintf(stderr, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'\n", name, type, domain); |
293 | + break; |
294 | + |
295 | + case AVAHI_BROWSER_ALL_FOR_NOW: |
296 | + if (debug) |
297 | + fprintf(stderr, "(Browser) %s\n", "ALL_FOR_NOW"); |
298 | + exit(0); |
299 | + break; |
300 | + |
301 | + case AVAHI_BROWSER_CACHE_EXHAUSTED: |
302 | + if (debug) |
303 | + fprintf(stderr, "(Browser) %s\n", "CACHE_EXHAUSTED"); |
304 | + break; |
305 | + } |
306 | +} |
307 | + |
308 | +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) { |
309 | + AvahiServerConfig config; |
310 | + AvahiSServiceBrowser *sb = NULL; |
311 | + int error; |
312 | + int ret = 1; |
313 | + |
314 | + if (getenv("SQUID_DEB_PROXY_FIND_DEBUG")) |
315 | + debug = 1; |
316 | + |
317 | + /* Initialize the pseudo-RNG */ |
318 | + srand(time(NULL)); |
319 | + |
320 | + if (!debug) |
321 | + avahi_set_log_function(quiet_logger); |
322 | + |
323 | + /* Allocate main loop object */ |
324 | + if (!(simple_poll = avahi_simple_poll_new())) { |
325 | + fprintf(stderr, "Failed to create simple poll object.\n"); |
326 | + goto fail; |
327 | + } |
328 | + |
329 | + /* Do not publish any local records */ |
330 | + avahi_server_config_init(&config); |
331 | + config.publish_hinfo = 0; |
332 | + config.publish_addresses = 0; |
333 | + config.publish_workstation = 0; |
334 | + config.publish_domain = 0; |
335 | + |
336 | + /* Allocate a new server */ |
337 | + server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, NULL, NULL, &error); |
338 | + |
339 | + /* Free the configuration data */ |
340 | + avahi_server_config_free(&config); |
341 | + |
342 | + /* Check whether creating the server object succeeded */ |
343 | + if (!server) { |
344 | + fprintf(stderr, "Failed to create server: %s\n", avahi_strerror(error)); |
345 | + goto fail; |
346 | + } |
347 | + |
348 | + /* Create the service browser */ |
349 | + // FIXME: use AVAHI_PROTO_UNSPEC for ipv6 at some point |
350 | + if (!(sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, "_apt_proxy._tcp", NULL, 0, browse_callback, server))) { |
351 | + fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_server_errno(server))); |
352 | + goto fail; |
353 | + } |
354 | + |
355 | + /* Run the main loop */ |
356 | + avahi_simple_poll_loop(simple_poll); |
357 | + |
358 | + ret = 0; |
359 | + |
360 | +fail: |
361 | + |
362 | + /* Cleanup things */ |
363 | + if (sb) |
364 | + avahi_s_service_browser_free(sb); |
365 | + |
366 | + if (server) |
367 | + avahi_server_free(server); |
368 | + |
369 | + if (simple_poll) |
370 | + avahi_simple_poll_free(simple_poll); |
371 | + |
372 | + return ret; |
373 | +} |
374 | |
375 | === added directory 'contrib' |
376 | === renamed directory 'contrib' => 'contrib.moved' |
377 | === added file 'contrib/squid-deb-proxy.init' |
378 | --- contrib/squid-deb-proxy.init 1970-01-01 00:00:00 +0000 |
379 | +++ contrib/squid-deb-proxy.init 2012-03-30 12:19:23 +0000 |
380 | @@ -0,0 +1,185 @@ |
381 | +#! /bin/sh |
382 | +# |
383 | +# squid-deb-proxy Startup script for the SQUID Deb HTTP proxy-cache. |
384 | +# |
385 | +# Version: @(#)squid-deb-proxy.rc 1.0 12-Mar-2011 andrew.simpson@corokia.co.nz |
386 | +# |
387 | +### BEGIN INIT INFO |
388 | +# Provides: squid-deb-proxy |
389 | +# Required-Start: $network $remote_fs $syslog |
390 | +# Required-Stop: $network $remote_fs $syslog |
391 | +# Should-Start: $named |
392 | +# Should-Stop: $named |
393 | +# Default-Start: 2 3 4 5 |
394 | +# Default-Stop: 0 1 6 |
395 | +# Short-Description: Squid Deb Package HTTP Proxy |
396 | +### END INIT INFO |
397 | + |
398 | +NAME=squid-deb-proxy |
399 | +DESC="Squid Deb HTTP Proxy" |
400 | +DAEMON=/usr/sbin/squid3 |
401 | +PIDFILE=/var/run/$NAME.pid |
402 | +CONFIG=/etc/squid-deb-proxy/squid-deb-proxy.conf |
403 | +AVAHIFILE=/etc/avahi/services/squid-deb-proxy.service |
404 | +SQUID_ARGS="-YC -f $CONFIG" |
405 | + |
406 | +[ ! -f /etc/default/squid-deb-proxy ] || . /etc/default/squid-deb-proxy |
407 | + |
408 | +. /lib/lsb/init-functions |
409 | + |
410 | +PATH=/bin:/usr/bin:/sbin:/usr/sbin |
411 | + |
412 | +[ -x $DAEMON ] || exit 0 |
413 | + |
414 | +ulimit -n 65535 |
415 | + |
416 | +find_cache_dir () { |
417 | + w=" " # space tab |
418 | + res=`sed -ne ' |
419 | + s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p; |
420 | + t end; |
421 | + d; |
422 | + :end q' < $CONFIG` |
423 | + [ -n "$res" ] || res=$2 |
424 | + echo "$res" |
425 | +} |
426 | + |
427 | +find_cache_port () { |
428 | + w=" " # space tab |
429 | + res=`sed -ne ' |
430 | + s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p; |
431 | + t end; |
432 | + d; |
433 | + :end q' < $CONFIG` |
434 | + [ -n "$res" ] || res=$2 |
435 | + echo "$res" |
436 | +} |
437 | + |
438 | +write_avahi_service () { |
439 | + port=`find_cache_port http_port 8000` |
440 | + cat > $AVAHIFILE << EOF |
441 | +<?xml version="1.0" standalone='no'?> |
442 | +<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> |
443 | +<service-group> |
444 | + <name replace-wildcards="yes">Squid deb proxy on %h</name> |
445 | + <service protocol="ipv4"> |
446 | + <type>_apt_proxy._tcp</type> |
447 | + <port>$port</port> |
448 | + </service> |
449 | +</service-group> |
450 | +EOF |
451 | +} |
452 | + |
453 | +remove_avahi_service () { |
454 | + if [ -f $AVAHIFILE ] |
455 | + then |
456 | + rm $AVAHIFILE |
457 | + fi |
458 | +} |
459 | + |
460 | +start () { |
461 | + cache_dir=`find_cache_dir cache_dir /var/spool/squid-deb-proxy` |
462 | + |
463 | + # |
464 | + # Create spool dirs if they don't exist. |
465 | + # |
466 | + if [ -d "$cache_dir" -a ! -d "$cache_dir/00" ] |
467 | + then |
468 | + log_warning_msg "Creating $DESC cache structure" |
469 | + $DAEMON -f $CONFIG -z |
470 | + fi |
471 | + |
472 | + write_avahi_service |
473 | + umask 027 |
474 | + ulimit -n 65535 |
475 | + cd $cache_dir |
476 | + start-stop-daemon --quiet --start \ |
477 | + --pidfile $PIDFILE \ |
478 | + --exec $DAEMON -- $SQUID_ARGS < /dev/null |
479 | + status=$? |
480 | + if [ $status -eq 0 ] |
481 | + then |
482 | + write_avahi_service |
483 | + fi |
484 | + return $status |
485 | +} |
486 | + |
487 | +stop () { |
488 | + remove_avahi_service |
489 | + PID=`cat $PIDFILE 2>/dev/null` |
490 | + start-stop-daemon --stop --quiet \ |
491 | + --pidfile $PIDFILE \ |
492 | + --exec $DAEMON -- -f $CONFIG |
493 | + # |
494 | + # Now we have to wait until squid has _really_ stopped. |
495 | + # |
496 | + sleep 2 |
497 | + if test -n "$PID" && kill -0 $PID 2>/dev/null |
498 | + then |
499 | + log_action_begin_msg " Waiting" |
500 | + cnt=0 |
501 | + while kill -0 $PID 2>/dev/null |
502 | + do |
503 | + cnt=`expr $cnt + 1` |
504 | + if [ $cnt -gt 24 ] |
505 | + then |
506 | + log_action_end_msg 1 |
507 | + return 1 |
508 | + fi |
509 | + sleep 5 |
510 | + log_action_cont_msg "" |
511 | + done |
512 | + log_action_end_msg 0 |
513 | + return 0 |
514 | + else |
515 | + return 0 |
516 | + fi |
517 | +} |
518 | + |
519 | +case "$1" in |
520 | + start) |
521 | + log_daemon_msg "Starting $DESC" "$NAME" |
522 | + if start ; then |
523 | + log_end_msg $? |
524 | + else |
525 | + log_end_msg $? |
526 | + fi |
527 | + ;; |
528 | + |
529 | + stop) |
530 | + log_daemon_msg "Stopping $DESC" "$NAME" |
531 | + if stop ; then |
532 | + log_end_msg $? |
533 | + else |
534 | + log_end_msg $? |
535 | + fi |
536 | + ;; |
537 | + |
538 | + reload|force-reload) |
539 | + log_action_msg "Reloading $DESC configuration files" |
540 | + remove_avahi_service |
541 | + start-stop-daemon --stop --signal 1 --quiet \ |
542 | + --pidfile $PIDFILE \ |
543 | + --exec $DAEMON -- -f $CONFIG |
544 | + log_action_end_msg 0 |
545 | + write_avahi_service |
546 | + ;; |
547 | + |
548 | + restart) |
549 | + log_daemon_msg "Restarting $DESC" "$NAME" |
550 | + stop |
551 | + if start ; then |
552 | + log_end_msg $? |
553 | + else |
554 | + log_end_msg $? |
555 | + fi |
556 | + ;; |
557 | + |
558 | + *) |
559 | + echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}" |
560 | + exit 3 |
561 | + ;; |
562 | +esac |
563 | + |
564 | +exit 0 |
565 | + |
566 | |
567 | === added directory 'debian' |
568 | === renamed directory 'debian' => 'debian.moved' |
569 | === added file 'debian/changelog' |
570 | --- debian/changelog 1970-01-01 00:00:00 +0000 |
571 | +++ debian/changelog 2012-03-30 12:19:23 +0000 |
572 | @@ -0,0 +1,192 @@ |
573 | +squid-deb-proxy (0.6.2) precise; urgency=low |
574 | + |
575 | + * squid-deb-proxy.conf: always refresh Packages and Release files. |
576 | + |
577 | + -- Robie Basak <robie.basak@ubuntu.com> Fri, 30 Mar 2012 11:15:29 +0100 |
578 | + |
579 | +squid-deb-proxy (0.6.1) precise; urgency=low |
580 | + |
581 | + [ Adam Gandelman ] |
582 | + * debian/squid-deb-proxy.upstart: Wrap squid execution in a script section. |
583 | + Also test for location/version of squid there, as the existing test in |
584 | + pre-start is out of scope but needed in both places. (LP: #893313) |
585 | + |
586 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 24 Nov 2011 16:26:34 +0100 |
587 | + |
588 | +squid-deb-proxy (0.6) precise; urgency=low |
589 | + |
590 | + * add (optional) support for squid3 |
591 | + |
592 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 03 Nov 2011 10:44:06 -0400 |
593 | + |
594 | +squid-deb-proxy (0.5.2) oneiric; urgency=low |
595 | + |
596 | + * Rework/simplify/fix the udeb based on the input from |
597 | + Colin Watson (thanks a lot!) |
598 | + * fix a bunch of lintian errors: |
599 | + - add missing po-debconf as build-depends |
600 | + - add debian/po/{POTFILES.in,templates.pot} |
601 | + |
602 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 30 Jun 2011 12:09:19 +0100 |
603 | + |
604 | +squid-deb-proxy (0.5.1) oneiric; urgency=low |
605 | + |
606 | + * debian/control: |
607 | + - fix architecture in squid-deb-proxy-client-udeb |
608 | + |
609 | + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 28 Jun 2011 12:35:19 +0100 |
610 | + |
611 | +squid-deb-proxy (0.5) oneiric; urgency=low |
612 | + |
613 | + * merged lp:~lynxman/squid-deb-proxy/debhooks, many thanks |
614 | + this adds debconf support to enable unrestricted network src |
615 | + access and access to PPA destinations |
616 | + * add support for a binary packagename blacklist |
617 | + * add .d directories for: |
618 | + - allowed-networks-src.acl.d |
619 | + - mirror-dstdomain.acl.d |
620 | + - pkg-blacklist.d |
621 | + * add squid-deb-proxy-client udeb |
622 | + * write debconf generated config to |
623 | + /etc/squid-deb-proxy/allowed-networks-src.acl.d/30-debconf |
624 | + /etc/squid-deb-proxy/mirror-dstdomain.acl.d/30-debconf |
625 | + * debian/control: |
626 | + - add avahi and pkg-config to the build-depends |
627 | + |
628 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 09 Jun 2011 15:34:11 +0200 |
629 | + |
630 | +squid-deb-proxy (0.4.2) natty; urgency=low |
631 | + |
632 | + * mirror-dstdomain.acl: |
633 | + - add mirrors.ubuntu.com for the mirror methods |
634 | + |
635 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 24 Mar 2011 17:50:10 +0100 |
636 | + |
637 | +squid-deb-proxy (0.4.1) natty; urgency=low |
638 | + |
639 | + * remove obsolete conffile on upgrade: |
640 | + /etc/init/squid-deb-proxy-avahi.conf |
641 | + |
642 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 24 Mar 2011 08:51:41 +0100 |
643 | + |
644 | +squid-deb-proxy (0.4) natty; urgency=low |
645 | + |
646 | + * mirror-dstdomain.acl: |
647 | + - add ddebs.ubuntu.com to default mirrors |
648 | + * apt-avahi-discover: |
649 | + - use avahi-resolve to workaround the issue that avahi-browse |
650 | + sometimes hands out ipv6 even when asked for ipv4 only, |
651 | + many thanks to Andrew Simpson (LP: #686265) |
652 | + * contrib/squid-deb-proxy.init: |
653 | + - add sysv init script, thanks to Andrew Simpson |
654 | + * debian/squid-deb-proxy.upstart: |
655 | + - write avahi services file on post-start and kill it again |
656 | + on pre-stop (LP: #695937) |
657 | + * debian/squid-deb-proxy.squid-deb-proxy-avahi.upstart: |
658 | + - removed, this is part of squid-deb-proxy.upstart now |
659 | + * Makefile: |
660 | + - fix permission of 30autoproxy (LP: #697955) |
661 | + * debian/squid-deb-proxy.logrotate: |
662 | + - add logrotate file (LP: #718923), thanks to |
663 | + Johan van Dijk and Andrew Simpson |
664 | + |
665 | + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 23 Mar 2011 21:53:11 +0100 |
666 | + |
667 | +squid-deb-proxy (0.3.4) natty; urgency=low |
668 | + |
669 | + * Removing expect fork and passing -N to squid to prevent upstart |
670 | + losing track of squid on reload (LP: #573853) |
671 | + |
672 | + -- Clint Byrum <clint@ubuntu.com> Tue, 11 Jan 2011 15:07:37 -0800 |
673 | + |
674 | +squid-deb-proxy (0.3.3) natty; urgency=low |
675 | + |
676 | + * Adjusting upstart job so restarting squid-deb-proxy does not result |
677 | + in killing squid-deb-proxy-avahi. (LP: #677276) |
678 | + * Also adjusting upstart job so squid-deb-proxy does not get started |
679 | + a real network interface is up and all local filesystems are mounted |
680 | + |
681 | + -- Clint Byrum <clint@ubuntu.com> Thu, 18 Nov 2010 16:27:24 -0800 |
682 | + |
683 | +squid-deb-proxy (0.3.2) natty; urgency=low |
684 | + |
685 | + [ Colin Dean ] |
686 | + * adding other ubuntu/canonical repos and some suggested |
687 | + others (but commented) (LP: #673080) |
688 | + * Added commented lines which allow non-specified domains to be |
689 | + accessed and (optionally) cached |
690 | + |
691 | + [ Jorge O. Castro ] |
692 | + * Add some popular repositories to cache (commented out) |
693 | + |
694 | + [ Michael Vogt ] |
695 | + * README: |
696 | + - updated to document the new options |
697 | + * debian/squid-deb-proxy.squid-deb-proxy-avahi.upstart: |
698 | + - fix upstart script so that the avahi service actually gets |
699 | + started (LP: #655187) |
700 | + |
701 | + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 10 Nov 2010 10:45:49 +0100 |
702 | + |
703 | +squid-deb-proxy (0.3.1) lucid; urgency=low |
704 | + |
705 | + * debian/squid-deb-proxy.squid-deb-proxy-avahi.upstart: |
706 | + - start only once avahi-daemon is available (thanks to dholbach) |
707 | + * debian/control: |
708 | + - add dependency on apt for squid-deb-proxy-client |
709 | + (thanks to dholbach) |
710 | + |
711 | + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 18 Mar 2010 15:05:12 +0100 |
712 | + |
713 | +squid-deb-proxy (0.3) lucid; urgency=low |
714 | + |
715 | + * debian/squid-deb-proxy.squid-deb-proxy-avahi.upstart: |
716 | + - advertise the proxy using avahi (if avahi is availalbe) |
717 | + * debian/control: |
718 | + - add recommends on avahi-utils to get avahi-publish |
719 | + * apt-avahi-discover: |
720 | + - provide a avahi based module suitable for apts |
721 | + Acquire::http::ProxyAutoDetect option |
722 | + * 30autoproxy: |
723 | + - add apt configuration that automatically uses apt-avahi-discover |
724 | + |
725 | + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 17 Feb 2010 14:04:56 +0100 |
726 | + |
727 | +squid-deb-proxy (0.2.3) lucid; urgency=low |
728 | + |
729 | + * debian/control: |
730 | + - move Vcs to lp:~squid-deb-proxy-developers/squid-deb-proxy/trunk |
731 | + - add homepage |
732 | + * mirror-dstdomain.acl: |
733 | + - add ports.ubuntu.com |
734 | + |
735 | + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 27 Jan 2010 15:02:15 +0100 |
736 | + |
737 | +squid-deb-proxy (0.2.2) lucid; urgency=low |
738 | + |
739 | + * mirror-dstdomain.acl: |
740 | + - add security.ubuntu.com to the allowed destdomains |
741 | + |
742 | + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 26 Jan 2010 09:19:50 +0100 |
743 | + |
744 | +squid-deb-proxy (0.2.1) lucid; urgency=low |
745 | + |
746 | + * initial lucid upload |
747 | + |
748 | + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 25 Jan 2010 18:13:26 +0100 |
749 | + |
750 | +squid-deb-proxy (0.2) lucid; urgency=low |
751 | + |
752 | + * README: |
753 | + - add documentation |
754 | + * *.acl: |
755 | + - split the bits that the user will most likely change into |
756 | + different files |
757 | + |
758 | + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 25 Jan 2010 18:13:15 +0100 |
759 | + |
760 | +squid-deb-proxy (0.1) lucid; urgency=low |
761 | + |
762 | + * initial version |
763 | + |
764 | + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 18 Jan 2010 12:11:19 +0100 |
765 | |
766 | === added file 'debian/compat' |
767 | --- debian/compat 1970-01-01 00:00:00 +0000 |
768 | +++ debian/compat 2012-03-30 12:19:23 +0000 |
769 | @@ -0,0 +1,1 @@ |
770 | +7 |
771 | \ No newline at end of file |
772 | |
773 | === added file 'debian/control' |
774 | --- debian/control 1970-01-01 00:00:00 +0000 |
775 | +++ debian/control 2012-03-30 12:19:23 +0000 |
776 | @@ -0,0 +1,52 @@ |
777 | +Source: squid-deb-proxy |
778 | +Section: net |
779 | +Priority: extra |
780 | +Maintainer: Michael Vogt <mvo@ubuntu.com> |
781 | +Build-Depends: debhelper (>= 7.0.50), |
782 | + gettext, |
783 | + intltool, |
784 | + pkg-config, |
785 | + po-debconf |
786 | +Standards-Version: 3.8.3 |
787 | +Vcs-Bzr: https://code.launchpad.net/~squid-deb-proxy-developers/squid-deb-proxy/trunk |
788 | +Homepage: https://launchpad.net/squid-deb-proxy |
789 | + |
790 | +Package: squid-deb-proxy |
791 | +Architecture: all |
792 | +Depends: ${python:Depends}, |
793 | + ${misc:Depends}, |
794 | + squid|squid3 |
795 | +Recommends: avahi-utils |
796 | +Description: Squid proxy configuration optimized for deb packages |
797 | + This package contains a squid proxy configuration that is optimized |
798 | + for downloading deb packages. It defaults to a different cache |
799 | + directory and port than the regular squid cache. |
800 | + . |
801 | + The config default to allowing cached access from a local network |
802 | + to *.archive.ubuntu.com. |
803 | + |
804 | +Package: squid-deb-proxy-client |
805 | +Architecture: all |
806 | +Depends: ${misc:Depends}, avahi-utils, apt (>= 0.7.25.3ubuntu1) |
807 | +Description: Automatic proxy discovery for apt based on avahi |
808 | + This package contains a helper for the apt http method to discover |
809 | + proxies that publish their service as _apt_proxy._tcp. |
810 | + . |
811 | + It was written to be installed on clients that should use |
812 | + squid-deb-proxy automatically, but it will work with any proxy |
813 | + that publishes the service as _apt_proxy._tcp. |
814 | + |
815 | +Package: squid-deb-proxy-client-udeb |
816 | +XC-Package-Type: udeb |
817 | +Section: debian-installer |
818 | +Architecture: all |
819 | +Depends: ${shlibs:Depends}, ${misc:Depends}, configured-network, |
820 | +Description: Automatic proxy discovery for apt based on avahi (udeb) |
821 | + This package contains a helper for the apt http method to discover |
822 | + proxies that publish their service as _apt_proxy._tcp. |
823 | + . |
824 | + It was written to be installed on clients that should use |
825 | + squid-deb-proxy automatically, but it will work with any proxy |
826 | + that publishes the service as _apt_proxy._tcp. |
827 | + . |
828 | + This package contains the udeb only |
829 | |
830 | === added file 'debian/copyright' |
831 | --- debian/copyright 1970-01-01 00:00:00 +0000 |
832 | +++ debian/copyright 2012-03-30 12:19:23 +0000 |
833 | @@ -0,0 +1,14 @@ |
834 | +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?rev=59 |
835 | + |
836 | +Files: * |
837 | +Copyright: (c) 2010 Canonical |
838 | +License: GPL-3 |
839 | + |
840 | +License: GPL-3 |
841 | + This package is free software; you can redistribute it and/or modify |
842 | + it under the terms of the GNU General Public License as published by |
843 | + the Free Software Foundation; version 3. |
844 | + . |
845 | + On Debian systems, the complete text of the GNU General |
846 | + Public License can be found in `/usr/share/common-licenses/GPL-3'. |
847 | + |
848 | |
849 | === added directory 'debian/po' |
850 | === added file 'debian/po/POTFILES.in' |
851 | --- debian/po/POTFILES.in 1970-01-01 00:00:00 +0000 |
852 | +++ debian/po/POTFILES.in 2012-03-30 12:19:23 +0000 |
853 | @@ -0,0 +1,1 @@ |
854 | +[type: gettext/rfc822deb] squid-deb-proxy.templates |
855 | |
856 | === added file 'debian/po/templates.pot' |
857 | --- debian/po/templates.pot 1970-01-01 00:00:00 +0000 |
858 | +++ debian/po/templates.pot 2012-03-30 12:19:23 +0000 |
859 | @@ -0,0 +1,48 @@ |
860 | +# SOME DESCRIPTIVE TITLE. |
861 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
862 | +# This file is distributed under the same license as the PACKAGE package. |
863 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
864 | +# |
865 | +#, fuzzy |
866 | +msgid "" |
867 | +msgstr "" |
868 | +"Project-Id-Version: PACKAGE VERSION\n" |
869 | +"Report-Msgid-Bugs-To: squid-deb-proxy@packages.debian.org\n" |
870 | +"POT-Creation-Date: 2011-06-30 12:07+0100\n" |
871 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
872 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
873 | +"Language-Team: LANGUAGE <LL@li.org>\n" |
874 | +"Language: \n" |
875 | +"MIME-Version: 1.0\n" |
876 | +"Content-Type: text/plain; charset=CHARSET\n" |
877 | +"Content-Transfer-Encoding: 8bit\n" |
878 | + |
879 | +#. Type: boolean |
880 | +#. Description |
881 | +#: ../squid-deb-proxy.templates:1001 |
882 | +msgid "Allow PPA (Personal Package Archive) access?" |
883 | +msgstr "" |
884 | + |
885 | +#. Type: boolean |
886 | +#. Description |
887 | +#: ../squid-deb-proxy.templates:1001 |
888 | +msgid "" |
889 | +"Squid-deb-proxy by default will not allow PPA repositories from launchpad. " |
890 | +"Selecting Y in this option will activate PPA repo access." |
891 | +msgstr "" |
892 | + |
893 | +#. Type: boolean |
894 | +#. Description |
895 | +#: ../squid-deb-proxy.templates:2001 |
896 | +msgid "Allow unrestricted network access?" |
897 | +msgstr "" |
898 | + |
899 | +#. Type: boolean |
900 | +#. Description |
901 | +#: ../squid-deb-proxy.templates:2001 |
902 | +msgid "" |
903 | +"Squid-deb-proxy restricts access to the cache to private networks only by " |
904 | +"default. Selecting Y in this option will allow unrestricted access of all " |
905 | +"IPs to access the cache. Selecting N will only allow private networks " |
906 | +"(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) to access the cache." |
907 | +msgstr "" |
908 | |
909 | === added file 'debian/postrm' |
910 | --- debian/postrm 1970-01-01 00:00:00 +0000 |
911 | +++ debian/postrm 2012-03-30 12:19:23 +0000 |
912 | @@ -0,0 +1,12 @@ |
913 | +#!/bin/sh |
914 | + |
915 | +set -e |
916 | + |
917 | +if [ "$1" = "purge" ]; then |
918 | + rm -rf /var/cache/squid-deb-proxy |
919 | + rm -rf /var/log/squid-deb-proxy |
920 | + rm -f /etc/squid-deb-proxy/squid-deb-proxy.conf |
921 | +fi |
922 | + |
923 | +#DEBHELPER# |
924 | + |
925 | |
926 | === added file 'debian/preinst' |
927 | --- debian/preinst 1970-01-01 00:00:00 +0000 |
928 | +++ debian/preinst 2012-03-30 12:19:23 +0000 |
929 | @@ -0,0 +1,54 @@ |
930 | +#!/bin/sh |
931 | +# preinst script for squid-deb-proxy |
932 | +# |
933 | + |
934 | +set -e |
935 | + |
936 | +# summary of how this script can be called: |
937 | +# * <new-preinst> `install' |
938 | +# * <new-preinst> `install' <old-version> |
939 | +# * <new-preinst> `upgrade' <old-version> |
940 | +# * <old-preinst> `abort-upgrade' <new-version> |
941 | +# for details, see http://www.debian.org/doc/debian-policy/ or |
942 | +# the debian-policy package |
943 | + |
944 | +# for lucid -> P upgrades we can't use dpkg-mainthelper |
945 | +rm_conffile() { |
946 | + local PKGNAME="$1" |
947 | + local CONFFILE="$2" |
948 | + |
949 | + [ -e "$CONFFILE" ] || return 0 |
950 | + |
951 | + local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" |
952 | + local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \ |
953 | + sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" |
954 | + if [ "$md5sum" != "$old_md5sum" ]; then |
955 | + echo "Obsolete conffile $CONFFILE has been modified by you." |
956 | + echo "Saving as $CONFFILE.dpkg-bak ..." |
957 | + mv -f "$CONFFILE" "$CONFFILE".dpkg-bak |
958 | + else |
959 | + echo "Removing obsolete conffile $CONFFILE ..." |
960 | + rm -f "$CONFFILE" |
961 | + fi |
962 | +} |
963 | + |
964 | + |
965 | +case "$1" in |
966 | + install|upgrade) |
967 | + if dpkg --compare-versions "$2" le "0.4.1"; then |
968 | + rm_conffile squid-deb-proxy /etc/init/squid-deb-proxy-avahi.conf |
969 | + fi |
970 | + ;; |
971 | + |
972 | + abort-upgrade) |
973 | + ;; |
974 | + |
975 | + *) |
976 | + echo "preinst called with unknown argument \`$1'" >&2 |
977 | + exit 1 |
978 | + ;; |
979 | +esac |
980 | + |
981 | +#DEBHELPER# |
982 | + |
983 | +exit 0 |
984 | |
985 | === added file 'debian/rules' |
986 | --- debian/rules 1970-01-01 00:00:00 +0000 |
987 | +++ debian/rules 2012-03-30 12:19:23 +0000 |
988 | @@ -0,0 +1,8 @@ |
989 | +#!/usr/bin/make -f |
990 | + |
991 | +%: |
992 | + dh $@ |
993 | + |
994 | +override_dh_installinit: |
995 | + dh_installinit $@ |
996 | + dh_installinit --name=squid-deb-proxy-avahi |
997 | \ No newline at end of file |
998 | |
999 | === added file 'debian/squid-deb-proxy-client-udeb.dirs' |
1000 | --- debian/squid-deb-proxy-client-udeb.dirs 1970-01-01 00:00:00 +0000 |
1001 | +++ debian/squid-deb-proxy-client-udeb.dirs 2012-03-30 12:19:23 +0000 |
1002 | @@ -0,0 +1,1 @@ |
1003 | +usr/lib/base-installer.d/ |
1004 | \ No newline at end of file |
1005 | |
1006 | === added file 'debian/squid-deb-proxy-client-udeb.install' |
1007 | --- debian/squid-deb-proxy-client-udeb.install 1970-01-01 00:00:00 +0000 |
1008 | +++ debian/squid-deb-proxy-client-udeb.install 2012-03-30 12:19:23 +0000 |
1009 | @@ -0,0 +1,1 @@ |
1010 | +../../udeb/80squid-deb-proxy-client ./usr/lib/base-installer.d/ |
1011 | |
1012 | === added file 'debian/squid-deb-proxy-client.install' |
1013 | --- debian/squid-deb-proxy-client.install 1970-01-01 00:00:00 +0000 |
1014 | +++ debian/squid-deb-proxy-client.install 2012-03-30 12:19:23 +0000 |
1015 | @@ -0,0 +1,2 @@ |
1016 | +usr/share/squid-deb-proxy-client/ |
1017 | +etc/apt/apt.conf.d |
1018 | \ No newline at end of file |
1019 | |
1020 | === added file 'debian/squid-deb-proxy.config' |
1021 | --- debian/squid-deb-proxy.config 1970-01-01 00:00:00 +0000 |
1022 | +++ debian/squid-deb-proxy.config 2012-03-30 12:19:23 +0000 |
1023 | @@ -0,0 +1,11 @@ |
1024 | +#!/bin/sh -e |
1025 | +# |
1026 | +# script to configure squid-deb-proxy |
1027 | + |
1028 | +# Source debconf library. |
1029 | +. /usr/share/debconf/confmodule |
1030 | + |
1031 | +# get inputs |
1032 | +db_input low squid-deb-proxy/ppa-enable || true |
1033 | +db_input low squid-deb-proxy/acl-disable || true |
1034 | +db_go |
1035 | |
1036 | === added file 'debian/squid-deb-proxy.install' |
1037 | --- debian/squid-deb-proxy.install 1970-01-01 00:00:00 +0000 |
1038 | +++ debian/squid-deb-proxy.install 2012-03-30 12:19:23 +0000 |
1039 | @@ -0,0 +1,1 @@ |
1040 | +etc/squid-deb-proxy |
1041 | |
1042 | === added file 'debian/squid-deb-proxy.logrotate' |
1043 | --- debian/squid-deb-proxy.logrotate 1970-01-01 00:00:00 +0000 |
1044 | +++ debian/squid-deb-proxy.logrotate 2012-03-30 12:19:23 +0000 |
1045 | @@ -0,0 +1,15 @@ |
1046 | +# |
1047 | +# Logrotate fragment for squid-deb-proxy. |
1048 | +# |
1049 | +/var/log/squid-deb-proxy/*.log { |
1050 | + daily |
1051 | + compress |
1052 | + delaycompress |
1053 | + rotate 2 |
1054 | + missingok |
1055 | + nocreate |
1056 | + sharedscripts |
1057 | + postrotate |
1058 | + test ! -e /var/run/squid-deb-proxy.pid || /usr/sbin/squid -f /etc/squid-deb-proxy/squid-deb-proxy.conf -k rotate |
1059 | + endscript |
1060 | +} |
1061 | |
1062 | === added file 'debian/squid-deb-proxy.postinst' |
1063 | --- debian/squid-deb-proxy.postinst 1970-01-01 00:00:00 +0000 |
1064 | +++ debian/squid-deb-proxy.postinst 2012-03-30 12:19:23 +0000 |
1065 | @@ -0,0 +1,131 @@ |
1066 | +#!/bin/sh |
1067 | +# postinst script for squid-deb-proxy |
1068 | +# |
1069 | +# see: dh_installdeb(1) |
1070 | + |
1071 | +set -e |
1072 | + |
1073 | +# summary of how this script can be called: |
1074 | +# * <postinst> `configure' <most-recently-configured-version> |
1075 | +# * <old-postinst> `abort-upgrade' <new version> |
1076 | +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
1077 | +# <new-version> |
1078 | +# * <postinst> `abort-remove' |
1079 | +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
1080 | +# <failed-install-package> <version> `removing' |
1081 | +# <conflicting-package> <version> |
1082 | +# for details, see http://www.debian.org/doc/debian-policy/ or |
1083 | +# the debian-policy package |
1084 | + |
1085 | +# A simplified version of debconf's own config script. |
1086 | +. /usr/share/debconf/confmodule |
1087 | + |
1088 | +USER_NETWORKS=/etc/squid-deb-proxy/allowed-networks-src.acl.d/10-default |
1089 | +USER_ALLOWED_DESTINATIONS=/etc/squid-deb-proxy/mirror-dstdomain.acl.d/10-default |
1090 | + |
1091 | +DEBCONF_NETWORKS=/etc/squid-deb-proxy/allowed-networks-src.acl.d/30-debconf |
1092 | +DEBCONF_ALLOWED_DESTINATIONS=/etc/squid-deb-proxy/mirror-dstdomain.acl.d/30-debconf |
1093 | + |
1094 | +case "$1" in |
1095 | + configure) |
1096 | + |
1097 | + # the users allowed networks, this is not a conffile so its created |
1098 | + # here |
1099 | + if [ ! -f "$USER_NETWORKS" ]; then |
1100 | + cat > "$USER_NETWORKS" <<EOF |
1101 | +# $USER_NETWORKS |
1102 | +# |
1103 | +# additional network sources that you want to allow access to the cache |
1104 | + |
1105 | +# example net |
1106 | +#136.199.8.0/24 |
1107 | +EOF |
1108 | + fi |
1109 | + |
1110 | + # the users allowed destinations, this is not a conffile |
1111 | + if [ ! -f "$USER_ALLOWED_DESTINATIONS" ]; then |
1112 | + cat > "$USER_ALLOWED_DESTINATIONS" <<EOF |
1113 | +# $USER_ALLOWED_DESTINATIONS |
1114 | +# |
1115 | +# network destinations that are allowed by this cache |
1116 | + |
1117 | +# launchpad personal package archives (disabled by default) |
1118 | +#ppa.launchpad.net |
1119 | + |
1120 | +# add additional mirror domains here (disabled by default) |
1121 | +#linux.dropbox.com |
1122 | +#download.virtualbox.org |
1123 | +#archive.getdeb.net |
1124 | +#packages.medibuntu.org |
1125 | +#dl.google.com |
1126 | +EOF |
1127 | + fi |
1128 | + |
1129 | + # pkg blacklist, not a conffile |
1130 | + PKG_BLACKLIST_IN=/etc/squid-deb-proxy/pkg-blacklist.d/10-default |
1131 | + cat > $PKG_BLACKLIST_IN <<EOF |
1132 | +# $PKG_BLACKLIST_IN |
1133 | +# |
1134 | +# packages that should be not allowed for download, one binary packagename |
1135 | +# per line |
1136 | +# |
1137 | +#skype |
1138 | +EOF |
1139 | + |
1140 | + # get the debconf answers |
1141 | + db_get squid-deb-proxy/ppa-enable |
1142 | + case "$RET" in |
1143 | + false) |
1144 | + rm -f "$DEBCONF_ALLOWED_DESTINATIONS" |
1145 | + ;; |
1146 | + true) |
1147 | + cat > "$DEBCONF_ALLOWED_DESTINATIONS" <<EOF |
1148 | +# automatically added by debconf, please use: |
1149 | +# sudo dpkg-reconfigure -plow squid-deb-proxy |
1150 | +# to change |
1151 | +ppa.launchpad.net |
1152 | +EOF |
1153 | + ;; |
1154 | + *) |
1155 | + echo "db_get returned unexpected result: '$RET' for squid-deb-proxy/ppa-enable" |
1156 | + exit 1 |
1157 | + ;; |
1158 | + esac |
1159 | + |
1160 | + db_get squid-deb-proxy/acl-disable |
1161 | + case "$RET" in |
1162 | + false) |
1163 | + rm -f "$DEBCONF_NETWORKS" |
1164 | + ;; |
1165 | + true) |
1166 | + cat > "$DEBCONF_NETWORKS" <<EOF |
1167 | +# automatically added by debconf, please use: |
1168 | +# sudo dpkg-reconfigure -plow squid-deb-proxy |
1169 | +# to change |
1170 | +0.0.0.0/0.0.0.0 |
1171 | +EOF |
1172 | + ;; |
1173 | + *) |
1174 | + echo "db_get returned unexpected result: '$RET' for squid-deb-proxy/acl-disable" |
1175 | + exit 1 |
1176 | + ;; |
1177 | + esac |
1178 | + |
1179 | + invoke-rc.d squid-deb-proxy restart || true |
1180 | + ;; |
1181 | + |
1182 | + abort-upgrade|abort-remove|abort-deconfigure|triggered) |
1183 | + ;; |
1184 | + |
1185 | + *) |
1186 | + echo "postinst called with unknown argument \`$1'" >&2 |
1187 | + exit 1 |
1188 | + ;; |
1189 | +esac |
1190 | + |
1191 | +# dh_installdeb will replace this with shell code automatically |
1192 | +# generated by other debhelper scripts. |
1193 | + |
1194 | +#DEBHELPER# |
1195 | + |
1196 | +exit 0 |
1197 | |
1198 | === added file 'debian/squid-deb-proxy.postrm' |
1199 | --- debian/squid-deb-proxy.postrm 1970-01-01 00:00:00 +0000 |
1200 | +++ debian/squid-deb-proxy.postrm 2012-03-30 12:19:23 +0000 |
1201 | @@ -0,0 +1,11 @@ |
1202 | +#!/bin/sh |
1203 | + |
1204 | +set -e |
1205 | + |
1206 | +if [ "$1" = "purge" ]; then |
1207 | + rm -f /etc/squid-deb-proxy/autogenerated/* |
1208 | +fi |
1209 | + |
1210 | +#DEBHELPER# |
1211 | + |
1212 | +exit 0 |
1213 | |
1214 | === added file 'debian/squid-deb-proxy.templates' |
1215 | --- debian/squid-deb-proxy.templates 1970-01-01 00:00:00 +0000 |
1216 | +++ debian/squid-deb-proxy.templates 2012-03-30 12:19:23 +0000 |
1217 | @@ -0,0 +1,16 @@ |
1218 | +Template: squid-deb-proxy/ppa-enable |
1219 | +Type: boolean |
1220 | +Default: false |
1221 | +_Description: Allow PPA (Personal Package Archive) access? |
1222 | + Squid-deb-proxy by default will not allow PPA repositories from launchpad. |
1223 | + Selecting Y in this option will activate PPA repo access. |
1224 | + |
1225 | +Template: squid-deb-proxy/acl-disable |
1226 | +Type: boolean |
1227 | +Default: false |
1228 | +_Description: Allow unrestricted network access? |
1229 | + Squid-deb-proxy restricts access to the cache to private networks |
1230 | + only by default. |
1231 | + Selecting Y in this option will allow unrestricted access of all IPs |
1232 | + to access the cache. Selecting N will only allow private networks |
1233 | + (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) to access the cache. |
1234 | |
1235 | === added file 'debian/squid-deb-proxy.upstart' |
1236 | --- debian/squid-deb-proxy.upstart 1970-01-01 00:00:00 +0000 |
1237 | +++ debian/squid-deb-proxy.upstart 2012-03-30 12:19:23 +0000 |
1238 | @@ -0,0 +1,105 @@ |
1239 | +# squid-deb-proxy - a proxy for deb packages |
1240 | +# |
1241 | + |
1242 | +description "squid-deb-proxy" |
1243 | + |
1244 | +env AVAHIFILE=/etc/avahi/services/squid-deb-proxy.service |
1245 | + |
1246 | +pre-start script |
1247 | + concat_file_from_dir() { |
1248 | + # the .d directory |
1249 | + DIR="$1" |
1250 | + # the target file |
1251 | + FILE="$2" |
1252 | + # (optional) additional file append to $FILE |
1253 | + ADDITIONAL_FILE_TO_CAT="$3" |
1254 | + cat > $FILE <<EOF |
1255 | +# WARNING: this file is auto-generated from the files in |
1256 | +# $DIR |
1257 | +# on squid-deb-proxy (re)start, do NOT edit here |
1258 | +EOF |
1259 | + if [ -n "$ADDITIONAL_FILE_TO_CAT" ]; then |
1260 | + cat "$ADDITIONAL_FILE_TO_CAT" >> "$FILE" |
1261 | + fi |
1262 | + |
1263 | + for f in "$DIR"/*; do |
1264 | + cat "$f" >> "$FILE" |
1265 | + done |
1266 | + } |
1267 | + |
1268 | + if [ -x /usr/sbin/squid ]; then |
1269 | + SQUID=/usr/sbin/squid |
1270 | + elif [ -x /usr/sbin/squid3 ]; then |
1271 | + SQUID=/usr/sbin/squid3 |
1272 | + else |
1273 | + echo "No squid binary found" |
1274 | + exit 1 |
1275 | + fi |
1276 | + |
1277 | + # ensure all cache dirs are there |
1278 | + install -d -o proxy -g proxy -m 750 /var/cache/squid-deb-proxy/ |
1279 | + install -d -o proxy -g proxy -m 750 /var/log/squid-deb-proxy/ |
1280 | + if [ ! -d /var/cache/squid-deb-proxy/00 ]; then |
1281 | + $SQUID -z -f /etc/squid-deb-proxy/squid-deb-proxy.conf |
1282 | + fi |
1283 | + |
1284 | + # generate pkg blacklist acl file |
1285 | + PKG_BLACKLIST_DIR=/etc/squid-deb-proxy/pkg-blacklist.d |
1286 | + PKG_BLACKLIST=/etc/squid-deb-proxy/autogenerated/pkg-blacklist-regexp.acl |
1287 | + concat_file_from_dir "$PKG_BLACKLIST_DIR" "$PKG_BLACKLIST" |
1288 | + # postprocess for regexp format |
1289 | + sed -i -r '/^#/d;/^$/d;s#(.*)#\/\1_.*\.deb$#g' $PKG_BLACKLIST |
1290 | + |
1291 | + # generate mirror file |
1292 | + MIRROR_DESTDOMAIN_DIR=/etc/squid-deb-proxy/mirror-dstdomain.acl.d |
1293 | + MIRROR_DESTDOMAIN=/etc/squid-deb-proxy/autogenerated/mirror-dstdomain.acl |
1294 | + concat_file_from_dir "$MIRROR_DESTDOMAIN_DIR" "$MIRROR_DESTDOMAIN" "/etc/squid-deb-proxy/mirror-dstdomain.acl" |
1295 | + |
1296 | + # generate the allowed-networks file |
1297 | + ALLOWED_NETWORKS_DIR=/etc/squid-deb-proxy/allowed-networks-src.acl.d |
1298 | + ALLOWED_NETWORKS=/etc/squid-deb-proxy/autogenerated/allowed-networks-src.acl |
1299 | + concat_file_from_dir "$ALLOWED_NETWORKS_DIR" "$ALLOWED_NETWORKS" "/etc/squid-deb-proxy/allowed-networks-src.acl" |
1300 | + |
1301 | +end script |
1302 | + |
1303 | +post-start script |
1304 | + # create avahi service |
1305 | + PORT=$(grep http_port /etc/squid-deb-proxy/squid-deb-proxy.conf|cut -d' ' -f2) |
1306 | + if [ -n "$PORT" ] && [ -d /etc/avahi/services/ ]; then |
1307 | + cat > $AVAHIFILE << EOF |
1308 | +<?xml version="1.0" standalone='no'?> |
1309 | +<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> |
1310 | +<service-group> |
1311 | + <name replace-wildcards="yes">Squid deb proxy on %h</name> |
1312 | + <service protocol="ipv4"> |
1313 | + <type>_apt_proxy._tcp</type> |
1314 | + <port>$PORT</port> |
1315 | + </service> |
1316 | +</service-group> |
1317 | +EOF |
1318 | + fi |
1319 | +end script |
1320 | + |
1321 | +# if this is done in pre-stop "restart squid-deb-proxy" kills the |
1322 | +# file without putting a replacement in! |
1323 | +post-stop script |
1324 | + if [ -f $AVAHIFILE ] |
1325 | + then |
1326 | + rm $AVAHIFILE |
1327 | + fi |
1328 | +end script |
1329 | + |
1330 | +start on (local-filesystems and net-device-up IFACE!=lo) |
1331 | +stop on runlevel [!2345] |
1332 | + |
1333 | +script |
1334 | + if [ -x /usr/sbin/squid ]; then |
1335 | + SQUID=/usr/sbin/squid |
1336 | + elif [ -x /usr/sbin/squid3 ]; then |
1337 | + SQUID=/usr/sbin/squid3 |
1338 | + else |
1339 | + echo "No squid binary found" |
1340 | + exit 1 |
1341 | + fi |
1342 | + exec $SQUID -N -f /etc/squid-deb-proxy/squid-deb-proxy.conf |
1343 | +end script |
1344 | |
1345 | === added file 'mirror-dstdomain.acl' |
1346 | --- mirror-dstdomain.acl 1970-01-01 00:00:00 +0000 |
1347 | +++ mirror-dstdomain.acl 2012-03-30 12:19:23 +0000 |
1348 | @@ -0,0 +1,21 @@ |
1349 | +# mirror-dstdomain.conf |
1350 | +# |
1351 | +# network destinations that are allowed by this cache |
1352 | + |
1353 | +# default ubuntu and ubuntu country archive mirrors |
1354 | +.archive.ubuntu.com |
1355 | +ports.ubuntu.com |
1356 | +security.ubuntu.com |
1357 | +ddebs.ubuntu.com |
1358 | +mirrors.ubuntu.com |
1359 | + |
1360 | +#official third party repositories |
1361 | +archive.canonical.com |
1362 | +extras.ubuntu.com |
1363 | + |
1364 | +# default changelogs location, this includes changelogs and the meta-release |
1365 | +# file that has information about new ubuntu versions |
1366 | +changelogs.ubuntu.com |
1367 | + |
1368 | +# additional destinations can be added to the directory: |
1369 | +# /etc/squid-deb-proxy/mirror-destdomain.acl.d |
1370 | |
1371 | === renamed file 'mirror-dstdomain.acl' => 'mirror-dstdomain.acl.moved' |
1372 | === added file 'squid-deb-proxy.conf' |
1373 | --- squid-deb-proxy.conf 1970-01-01 00:00:00 +0000 |
1374 | +++ squid-deb-proxy.conf 2012-03-30 12:19:23 +0000 |
1375 | @@ -0,0 +1,93 @@ |
1376 | + |
1377 | +# WELCOME TO SQUID DEB PROXY |
1378 | +# ------------------ |
1379 | +# |
1380 | +# This config file is a version of a squid proxy file optimized |
1381 | +# as a configuration for a caching proxy for Ubuntu systems. |
1382 | +# |
1383 | +# More information about squid and its configuration can be found here |
1384 | +# http://www.squid-cache.org/ and in the FAQ |
1385 | + |
1386 | +# settings that you may want to customize |
1387 | +# --------------------------------------- |
1388 | + |
1389 | +# this file contains private networks (10.0.0.0/8, 172.16.0.0/12, |
1390 | +# 192.168.0.0/16) by default, you can add/remove additional allowed |
1391 | +# source networks in it to customize it for your setup |
1392 | +acl allowed_networks src "/etc/squid-deb-proxy/autogenerated/allowed-networks-src.acl" |
1393 | + |
1394 | +# this file contains the *archive.ubuntu.com mirrors by default, |
1395 | +# if you use a different mirror, add it there |
1396 | +acl to_ubuntu_mirrors dstdomain "/etc/squid-deb-proxy/autogenerated/mirror-dstdomain.acl" |
1397 | + |
1398 | +# this contains the package blacklist |
1399 | +acl blockedpkgs urlpath_regex "/etc/squid-deb-proxy/autogenerated/pkg-blacklist-regexp.acl" |
1400 | + |
1401 | +# default to a different port than stock squid |
1402 | +http_port 8000 |
1403 | + |
1404 | +# ------------------------------------------------- |
1405 | +# settings below probably do not need customization |
1406 | + |
1407 | +# user visible name |
1408 | +visible_hostname squid-deb-proxy |
1409 | + |
1410 | +# we need a big cache, some debs are huge |
1411 | +maximum_object_size 512 MB |
1412 | + |
1413 | +# use a different dir than stock squid and default to 40G |
1414 | +cache_dir ufs /var/cache/squid-deb-proxy 40000 16 256 |
1415 | + |
1416 | +# use different logs |
1417 | +cache_access_log /var/log/squid-deb-proxy/access.log |
1418 | +cache_log /var/log/squid-deb-proxy/cache.log |
1419 | +cache_store_log /var/log/squid-deb-proxy/store.log |
1420 | + |
1421 | +# tweaks to speed things up |
1422 | +cache_mem 200 MB |
1423 | +maximum_object_size_in_memory 10240 KB |
1424 | + |
1425 | +# pid |
1426 | +pid_filename /var/run/squid-deb-proxy.pid |
1427 | + |
1428 | +# refresh pattern for debs and udebs |
1429 | +refresh_pattern deb$ 129600 100% 129600 |
1430 | +refresh_pattern udeb$ 129600 100% 129600 |
1431 | +refresh_pattern tar.gz$ 129600 100% 129600 |
1432 | + |
1433 | +# always refresh Packages and Release files |
1434 | +refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz)$ 0 0% 0 |
1435 | +refresh_pattern \/Release(|\.gpg)$ 0 0% 0 |
1436 | + |
1437 | +# handle meta-release and changelogs.ubuntu.com special |
1438 | +refresh_pattern changelogs.ubuntu.com/* 0 1% 1 |
1439 | + |
1440 | +# default acl |
1441 | +acl all src all |
1442 | +acl localhost src 127.0.0.1/32 |
1443 | + |
1444 | +# only allow connects to ports for http, https |
1445 | +acl Safe_ports port 80 |
1446 | +acl Safe_ports port 443 563 |
1447 | + |
1448 | +# only allow ports we trust |
1449 | +http_access deny !Safe_ports |
1450 | + |
1451 | +# do not allow to download from the pkg blacklist |
1452 | +http_access deny blockedpkgs |
1453 | + |
1454 | +# allow access only to official ubuntu mirrors |
1455 | +# uncomment the third and fouth line to permit any unlisted domain |
1456 | +http_access deny !to_ubuntu_mirrors |
1457 | +#http_access allow !to_ubuntu_mirrors |
1458 | + |
1459 | +# don't cache domains not listed in the mirrors file |
1460 | +# uncomment the third and fourth line to cache any unlisted domains |
1461 | +cache deny !to_ubuntu_mirrors |
1462 | +#cache allow !to_ubuntu_mirrors |
1463 | + |
1464 | +# allow access from our network and localhost |
1465 | +http_access allow allowed_networks |
1466 | + |
1467 | +# And finally deny all other access to this proxy |
1468 | +http_access deny all |
1469 | |
1470 | === renamed file 'squid-deb-proxy.conf' => 'squid-deb-proxy.conf.moved' |
1471 | === added directory 'tests' |
1472 | === renamed directory 'tests' => 'tests.moved' |
1473 | === added file 'tests/test_acl.sh' |
1474 | --- tests/test_acl.sh 1970-01-01 00:00:00 +0000 |
1475 | +++ tests/test_acl.sh 2012-03-30 12:19:23 +0000 |
1476 | @@ -0,0 +1,36 @@ |
1477 | +#!/bin/sh |
1478 | + |
1479 | +CURL="curl -s -I" |
1480 | +count=0 |
1481 | +failure=0 |
1482 | + |
1483 | +assert_ok() { |
1484 | + if ! $CURL $1 | grep -q "HTTP/1.0 200 OK"; then |
1485 | + echo "ASSERT FAILURE for $@, assumed 200 OK" |
1486 | + failure=$(( $failure + 1 )) |
1487 | + fi |
1488 | + count=$(( $count + 1 )) |
1489 | +} |
1490 | + |
1491 | +assert_forbidden() { |
1492 | + if ! $CURL $1 | grep -q "HTTP/1.0 403 Forbidden"; then |
1493 | + echo "ASSERT FAILURE for $@, assumed 403 Forbidden" |
1494 | + failure=$(( $failure + 1 )) |
1495 | + fi |
1496 | + count=$(( $count + 1 )) |
1497 | +} |
1498 | + |
1499 | + |
1500 | +http_proxy=http://localhost:8000/ |
1501 | +echo "Starting tests for $http_proxy" |
1502 | + |
1503 | +assert_ok "http://archive.ubuntu.com" |
1504 | +assert_ok "http://de.archive.ubuntu.com/ubuntu/" |
1505 | +assert_ok "http://changelogs.ubuntu.com/meta-release" |
1506 | + |
1507 | +assert_forbidden "http://wiki.ubuntu.com" |
1508 | +assert_forbidden "http://www.ubuntu.com" |
1509 | +assert_forbidden "http://example.com" |
1510 | +assert_forbidden "http://example.com:21" |
1511 | + |
1512 | +echo "Test finished, tests failed: $failure, tests run: $count" |
1513 | \ No newline at end of file |
1514 | |
1515 | === added directory 'udeb' |
1516 | === renamed directory 'udeb' => 'udeb.moved' |
1517 | === added file 'udeb/80squid-deb-proxy-client' |
1518 | --- udeb/80squid-deb-proxy-client 1970-01-01 00:00:00 +0000 |
1519 | +++ udeb/80squid-deb-proxy-client 2012-03-30 12:19:23 +0000 |
1520 | @@ -0,0 +1,9 @@ |
1521 | +#!/bin/sh -e |
1522 | +# queue squid-deb-proxy-client for install early |
1523 | + |
1524 | +log () { |
1525 | + logger -t hw-detect "$@" |
1526 | +} |
1527 | + |
1528 | +log "Queuing squid-deb-proxy-client" |
1529 | +apt-install squid-deb-proxy-client |
Thanks, I manually merged this into trunk now (as the branches are incompatible, probably ubuntu vs upstream branch problem :-/