4ffada32ed45f6e9deae475f5d837877864724d3
[privoxy.git] / junkbuster-rh.spec
1 # $Id: junkbuster-rh.spec,v 1.30 2002/03/04 16:18:03 morcego Exp $
2 #
3 # Written by and Copyright (C) 2001 the SourceForge
4 # IJBSWA team.  http://ijbswa.sourceforge.net
5 #
6 # Based on the Internet Junkbuster originally written
7 # by and Copyright (C) 1997 Anonymous Coders and 
8 # Junkbusters Corporation.  http://www.junkbusters.com
9 #
10 # This program is free software; you can redistribute it 
11 # and/or modify it under the terms of the GNU General
12 # Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at
14 # your option) any later version.
15 #
16 # This program is distributed in the hope that it will
17 # be useful, but WITHOUT ANY WARRANTY; without even the
18 # implied warranty of MERCHANTABILITY or FITNESS FOR A
19 # PARTICULAR PURPOSE.  See the GNU General Public
20 # License for more details.
21 #
22 # The GNU General Public License should be included with
23 # this file.  If not, you can view it at
24 # http://www.gnu.org/copyleft/gpl.html
25 # or write to the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27 #
28 # $Log: junkbuster-rh.spec,v $
29 # Revision 1.30  2002/03/04 16:18:03  morcego
30 # General cleanup of the rh specfile.
31 #
32 # %changelog
33 # * Mon Mar 04 2002 Rodrigo Barbosa <rodrigob@tisbrasil.com.br>
34 # + junkbuster-2.9.11-2
35 # - General specfile fixup, using the best recomended practices, including:
36 #         - Adding -q to %%setup
37 #         - Using macros whereever possible
38 #         - Not using wildchars on %%files section
39 #         - Doubling the percentage char on changelog and comments, to
40 #           avoid rpm expanding them
41 #
42 # Revision 1.29  2002/03/03 19:21:22  hal9
43 # Init script fails if shell is /bin/false.
44 #
45 # Revision 1.28  2002/01/09 18:34:03  hal9
46 # nit.
47 #
48 # Revision 1.27  2002/01/09 18:32:02  hal9
49 # Removed RPM_OPT_FLAGS kludge.
50 #
51 # Revision 1.26  2002/01/09 18:21:10  hal9
52 # A few minor updates.
53 #
54 # Revision 1.25  2001/12/28 01:45:36  steudten
55 # Add paranoia check and BuildReq: gzip
56 #
57 # Revision 1.24  2001/12/01 21:43:14  hal9
58 # Allowed for new ijb.action file.
59 #
60 # Revision 1.23  2001/11/06 12:09:03  steudten
61 # Compress doc files. Install README and AUTHORS at last as document.
62 #
63 # Revision 1.22  2001/11/05 21:37:34  steudten
64 # Fix to include the actual version for name.
65 # Let the 'real' packager be included - sorry stefan.
66 #
67 # Revision 1.21  2001/10/31 19:27:27  swa
68 # consistent description. new name for suse since
69 # we had troubles with rpms of identical names
70 # on the webserver.
71 #
72 # Revision 1.20  2001/10/24 15:45:49  hal9
73 # To keep Thomas happy (aka correcting my  mistakes)
74 #
75 # Revision 1.19  2001/10/15 03:23:59  hal9
76 # Nits.
77 #
78 # Revision 1.17  2001/10/10 18:59:28  hal9
79 # Minor change for init script.
80 #
81 # Revision 1.16  2001/09/24 20:56:23  hal9
82 # Minor changes.
83 #
84 # Revision 1.13  2001/09/10 17:44:43  swa
85 # integrate three pieces of documentation. needs work.
86 # will not build cleanly under redhat.
87 #
88 # Revision 1.12  2001/09/10 16:25:04  swa
89 # copy all templates. version updated.
90 #
91 # Revision 1.11  2001/07/03 11:00:25  sarantis
92 # replaced permissionsfile with actionsfile
93 #
94 # Revision 1.10  2001/07/03 09:34:44  sarantis
95 # bumped up version number.
96 #
97 # Revision 1.9  2001/06/12 18:15:29  swa
98 # the %% in front of configure (see tag below) confused
99 # the rpm build process on 7.1.
100 #
101 # Revision 1.8  2001/06/12 17:15:56  swa
102 # fixes, because a clean build on rh6.1 was impossible.
103 # GZIP confuses make, %% configure confuses rpm, etc.
104 #
105 # Revision 1.7  2001/06/11 12:17:26  sarantis
106 # fix typo in %%post
107 #
108 # Revision 1.6  2001/06/11 11:28:25  sarantis
109 # Further optimizations and adaptations in the spec file.
110 #
111 # Revision 1.5  2001/06/09 09:14:11  swa
112 # shamelessly adapted RPM stuff from the newest rpm that
113 # RedHat provided for the JB.
114 #
115 # Revision 1.4  2001/06/08 20:54:18  swa
116 # type with status file. remove forward et. al from file list.
117 #
118 # Revision 1.3  2001/06/07 17:28:10  swa
119 # cosmetics
120 #
121 # Revision 1.2  2001/06/04 18:31:58  swa
122 # files are now prefixed with either `confdir' or `logdir'.
123 # `make redhat-dist' replaces both entries confdir and logdir
124 # with redhat values
125 #
126 # Revision 1.1  2001/06/04 10:44:57  swa
127 # `make redhatr-dist' now works. Except for the paths
128 # in the config file.
129 #
130 #
131 #
132
133 # Defines should happen in the begining of the file
134 %define ijbconf %{_sysconfdir}/%{name}
135
136 Summary: The Internet Junkbuster
137 Vendor: http://ijbswa.sourceforge.net
138 Name: junkbuster
139 Version: 2.9.11
140 Release: 3
141 Source0: http://www.waldherr.org/%{name}/ijbswa-%{version}.tar.gz
142 License: GPL
143 BuildRoot: %{_tmppath}/%{name}-%{version}-root
144 Group: Networking/Utilities
145 URL: http://ijbswa.sourceforge.net/
146 Obsoletes: junkbuster-raw junkbuster-blank
147 Prereq: /usr/sbin/useradd , /sbin/chkconfig , /sbin/service 
148 BuildRequires: perl gzip
149 Conflicts: junkbuster-raw junkbuster-blank
150
151 %description
152 Internet Junkbuster is a web proxy with advanced filtering
153 capabilities for protecting privacy, filtering web page content,
154 managing cookies, controlling access, and removing ads, banners,
155 pop-ups and other obnoxious Internet Junk. Junkbuster has a very
156 flexible configuration and can be customized to suit individual needs
157 and tastes. Internet Junkbuster has application for both stand-alone
158 systems and multi-user networks.
159
160 %prep
161 %setup -q -c -n ijbswa
162
163 %build
164 %configure
165 make 
166
167 ## Explicitily stripping is not recomended.
168 ## This is handled altomaticaly by RPM, and can couse troubles if
169 ## anyone wants to build an unstriped version - morcego
170 #strip %{name}
171
172 %pre
173 /usr/sbin/useradd -d /etc/%{name} -r %{name} -s "" > /dev/null 2>&1 || /bin/true
174
175 %install
176 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
177 mkdir -p %{buildroot}%{_sbindir} \
178          %{buildroot}%{_mandir}/man8 \
179          %{buildroot}%{_localstatedir}/log/%{name} \
180          %{buildroot}%{ijbconf}/templates \
181          %{buildroot}%{_sysconfdir}/logrotate.d \
182          %{buildroot}%{_sysconfdir}/rc.d/init.d 
183
184 ## Manual gziping of manpages should not be done, once it can
185 ## break the building on some distributions. Anyway, rpm does it
186 ## automagicaly these days
187 ## Gziping the documentation files is not recomended - morcego
188 #gzip README AUTHORS ChangeLog %{name}.1 || /bin/true
189
190 install -s -m 744 %{name} %{buildroot}%{_sbindir}/%{name}
191 cp -f %{name}.1 %{buildroot}%{_mandir}/man8/%{name}.8
192 cp -f *.action %{buildroot}%{ijbconf}/
193 cp -f re_filterfile %{buildroot}%{ijbconf}/re_filterfile
194 cp -f trust %{buildroot}%{ijbconf}/trust
195 cp -f templates/*  %{buildroot}%{ijbconf}/templates/
196 cp -f %{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
197 install -m 755 %{name}.init %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
198 install -m 711 -d %{buildroot}%{_localstatedir}/log/%{name}
199
200 # verify all file locations, etc. in the config file
201 # don't start with ^ or commented lines are not replaced
202 ## Changing the sed paramter delimiter to @, so we don't have to
203 ## escape the slashes
204 cat config | \
205     sed 's@^confdir.*@confdir %{_sysconfdir}/%{name}@g' | \
206 #    sed 's/^permissionsfile.*/permissionsfile \/etc\/%{name}\/permissionsfile/g' | \
207 #    sed 's/^re_filterfile.*/re_filterfile \/etc\/%{name}\/re_filterfile/g' | \
208 #    sed 's/^logfile.*/logfile \%{_localstatedir}\/log\/%{name}\/logfile/g' | \
209 #    sed 's/^jarfile.*/jarfile \%{_localstatedir}\/log\/%{name}\/jarfile/g' | \
210 #    sed 's/^forward.*/forward \/etc\/%{name}\/forward/g' | \
211 #    sed 's/^aclfile.*/aclfile \/etc\/%{name}\/aclfile/g' > \
212     sed 's@^logdir.*@logdir %{_localstatedir}/log/%{name}@g' > \
213     %{buildroot}%{ijbconf}/config
214 perl -pe 's/{-no-cookies}/{-no-cookies}\n\.redhat.com/' ijb.action >\
215     %{buildroot}%{ijbconf}/ijb.action
216
217 ## Macros are expanded even on commentaries. So, we have to use %%
218 ## -- morcego
219 #%%makeinstall
220
221 %post
222 # for upgrade from 2.0.x
223 [ -f %{_localstatedir}/log/%{name}/%{name} ] &&\
224  mv -f %{_localstatedir}/log/%{name}/%{name} %{_localstatedir}/log/%{name}/logfile || /bin/true
225 chown -R %{name}:%{name} %{_localstatedir}/log/%{name} 2>/dev/null
226 chown -R %{name}:%{name} /etc/%{name} 2>/dev/null
227 if [ "$1" = "1" ]; then
228      /sbin/chkconfig --add %{name}
229         /sbin/service %{name} condrestart > /dev/null 2>&1
230 fi
231 # 01/09/02 HB, getting rid of any user=junkbust
232 grep junkbust: /etc/passwd >/dev/null && userdel junkbust || /bin/true
233
234 %preun
235 if [ "$1" = "0" ]; then
236         /sbin/service %{name} stop > /dev/null 2>&1 ||:
237         /sbin/chkconfig --del %{name}
238 fi
239
240 %postun
241 #if [ "$1" -ge "1" ]; then
242 #       /sbin/service %{name} condrestart > /dev/null 2>&1
243 #fi
244
245 %clean
246 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
247
248 %files
249 %defattr(0644,root,root,0755)
250 %doc README AUTHORS ChangeLog
251 # Where are the webserver/{developer,user}-manual files ?
252 %doc doc/text/developer-manual.txt doc/text/user-manual.txt
253 %doc doc/webserver/developer-manual
254 %doc doc/webserver/user-manual
255 #%doc %{name}.weekly %{name}.monthly AUTHORS
256
257 %dir %{ijbconf}
258 %dir %{ijbconf}/templates
259 %attr(0744,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
260
261 %attr(0744,%{name},%{name})%{_sbindir}/%{name}
262
263 # We should not use wildchars here. This could mask missing files problems
264 # -- morcego
265 %config %{ijbconf}/config
266 %config %{ijbconf}/ijb-advanced.action
267 %config %{ijbconf}/ijb-basic.action
268 %config %{ijbconf}/ijb-intermediate.action
269 %config %{ijbconf}/ijb.action
270 %config %{ijbconf}/re_filterfile
271 %config %{ijbconf}/trust
272
273 %config %{ijbconf}/templates/blocked
274 %config %{ijbconf}/templates/blocked-compact
275 %config %{ijbconf}/templates/cgi-error-404
276 %config %{ijbconf}/templates/cgi-error-bad-param
277 %config %{ijbconf}/templates/cgi-error-disabled
278 %config %{ijbconf}/templates/cgi-error-file
279 %config %{ijbconf}/templates/cgi-error-modified
280 %config %{ijbconf}/templates/cgi-error-parse
281 %config %{ijbconf}/templates/connect-failed
282 %config %{ijbconf}/templates/default
283 %config %{ijbconf}/templates/edit-actions-add-url-form
284 %config %{ijbconf}/templates/edit-actions-for-url
285 %config %{ijbconf}/templates/edit-actions-list
286 %config %{ijbconf}/templates/edit-actions-list-section
287 %config %{ijbconf}/templates/edit-actions-list-url
288 %config %{ijbconf}/templates/edit-actions-remove-url-form
289 %config %{ijbconf}/templates/edit-actions-url-form
290 %config %{ijbconf}/templates/no-such-domain
291 %config %{ijbconf}/templates/show-request
292 %config %{ijbconf}/templates/show-status
293 %config %{ijbconf}/templates/show-status-file
294 %config %{ijbconf}/templates/show-url-info
295 %config %{ijbconf}/templates/show-version
296 %config %{ijbconf}/templates/toggle
297 %config %{ijbconf}/templates/toggle-mini
298 %config %{ijbconf}/templates/untrusted
299
300 %config %{_sysconfdir}/logrotate.d/%{name}
301 %config %attr(0744,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
302
303 %{_mandir}/man8/%{name}.8*
304
305 %changelog
306 * Mon Mar 04 2002 Rodrigo Barbosa <rodrigob@tisbrasil.com.br>
307 + junkbuster-2.9.11-3
308 - Fixing permissions of the init script
309
310 * Mon Mar 04 2002 Rodrigo Barbosa <rodrigob@tisbrasil.com.br>
311 + junkbuster-2.9.11-2
312 - General specfile fixup, using the best recomended practices, including:
313         - Adding -q to %%setup
314         - Using macros whereever possible
315         - Not using wildchars on %%files section
316         - Doubling the percentage char on changelog and comments, to
317           avoid rpm expanding them
318
319
320 * Sun Mar 03 2002 Hal Burgiss <hal@foobox.net>
321 - /bin/false for shell causes init script to fail. Reverting.
322
323 * Wed Jan 09 2002 Hal Burgiss <hal@foobox.net>
324 - Removed UID 73. Included user-manual and developer-manual in docs.
325   Include other actions files. Default shell is now /bin/false.
326   Userdel user=junkbust. ChangeLog was not zipped. Removed 
327   RPM_OPT_FLAGS kludge.
328
329 * Fri Dec 28 2001 Thomas Steudten <thomas@steudten.ch>
330 - add paranoia check for 'rm -rf %%{buildroot}'
331 - add gzip to 'BuildRequires'
332
333 * Sat Dec  1 2001 Hal Burgiss <hal@foobox.net>
334 - actionsfile is now ijb.action.
335
336 * Tue Nov  6 2001 Thomas Steudten <thomas@steudten.ch>
337 - Compress manpage
338 - Add more documents for installation
339 - Add version string to name and source
340
341 * Wed Oct 24 2001 Hal Burigss <hal@foobox.net>
342 - Back to user 'junkbuster' and fix configure macro.
343
344 * Wed Oct 10 2001 Hal Burigss <hal@foobox.net>
345 - More changes for user 'junkbust'. Init script had 'junkbuster'.
346
347 * Sun Sep 23 2001 Hal Burgiss <hal@foobox.net>
348 - Change of $RPM_OPT_FLAGS handling. Added new HTML doc files.
349 - Changed owner of /etc/junkbuster to shut up PAM/xauth log noise.
350
351 * Thu Sep 13 2001 Hal Burgiss <hal@foobox.net>
352 - Added $RPM_OPT_FLAGS support, renaming of old logfile, and 
353 - made sure no default shell exists for user junkbust.
354
355 * Sun Jun  3 2001 Stefan Waldherr <stefan@waldherr.org>
356 - rework of RPM
357
358 * Mon Sep 25 2000 Stefan Waldherr <stefan@waldherr.org>
359 - CLF Logging patch by davep@cyw.uklinux.net
360 - Hal DeVore <haldevore@earthling.net> fix akamaitech in blocklist
361
362 * Sun Sep 17 2000 Stefan Waldherr <stefan@waldherr.org>
363 - Steve Kemp skx@tardis.ed.ac.uk's javascript popup patch.
364 - Markus Breitenbach breitenb@rbg.informatik.tu-darmstadt.de supplied
365   numerous fixes and enhancements for Steve's patch.
366 - adamlock@netscape.com (Adam Lock) in the windows version:
367   - Taskbar activity spinner always spins even when logging is
368   turned off (which is the default) - people who don't
369   like the spinner can turn it off from a menu option.
370   - Taskbar popup menu has a options submenu - people can now
371   open the settings files for cookies, blockers etc.
372   without opening the JB window.
373   - Logging functionality works again
374   - Buffer overflow is fixed - new code uses a bigger buffer
375   and snprintf so it shouldn't overflow anymore.
376 - Fixed userid swa, group learning problem while installing.
377   root must build RPM.
378 - Added patch by Benjamin Low <ben@snrc.uow.edu.au> that prevents JB to
379   core dump when there is no log file.
380 - Tweaked SuSE startup with the help of mohataj@gmx.net and Doc.B@gmx.de.
381 - Fixed man page to include imagefile and popupfile.
382 - Sanity check for the statistics function added.
383 - "Patrick D'Cruze" <pdcruze@orac.iinet.net.au>: It seems Microsoft
384  are transitioning Hotmail from FreeBSD/Apache to Windows 2000/IIS.
385  With IIS/5, it appears to omit the trailing \r\n from http header
386  only messages.  eg, when I visit http://www.hotmail.com, IIS/5
387  responds with a HTTP 302 redirect header.  However, this header
388  message is missing the trailing \r\n.  IIS/5 then closes the
389  connection.  Junkbuster, unfortunately, discards the header becomes
390  it thinks it is incomplete - and it is.  MS have transmitted an
391  incomplete header!
392 - Added bug reports and patch submission forms in the docs.
393
394 * Mon Mar 20 2000 Stefan Waldherr <stefan@waldherr.org>
395        Andrew <anw@tirana.freewire.co.uk> extended the JB:
396        Display of statistics of the total number of requests and the number
397        of requests filtered by junkbuster, also the percentage of requests
398        filtered. Suppression of the listing of files on the proxy-args page.
399        All stuff optional and configurable.
400
401 * Sun Sep 12 1999 Stefan Waldherr <stefan@waldherr.org>
402        Jan Willamowius (jan@janhh.shnet.org) fixed a bug in the 
403        code which prevented the JB from handling URLs of the form
404        user:password@www.foo.com. Fixed.
405
406 * Mon Aug  2 1999 Stefan Waldherr <stefan@waldherr.org>
407         Blank images are no longer cached, thanks to a hint from Markus 
408         Breitenbach <breitenb@rbg.informatik.tu-darmstadt.de>. The user 
409         agent is NO longer set by the Junkbuster. Sadly, many sites depend 
410         on the correct browser version nowadays. Incorporated many 
411         suggestions from Jan "Yenya" Kasprzak <kas@fi.muni.cz> for the
412         spec file. Fixed logging problem and since runlevel 2 does not 
413         use networking, I replaced /etc/rc.d/rc2.d/S84junkbuster with
414         /etc/rc.d/rc2.d/K09junkbuster thanks to Shaw Walker 
415         <walker@netgate.net>. You should now be able to build this RPM as 
416         a non-root user (mathias@weidner.sem.lipsia.de).
417
418 * Sun Jan 31 1999 Stefan Waldherr <stefan@waldherr.org>
419         %%{_localstatedir}/log/junkbuster set to nobody. Added /etc/junkbuster/imagelist
420         to allow more sophisticated matching of blocked images. Logrotate
421         logfile. Added files for auto-updating the blocklist et al.
422
423 * Wed Dec 16 1998 Stefan Waldherr <stefan@waldherr.org>
424         Configure blank version via config file. No separate blank
425         version anymore. Added Roland's <roland@spinnaker.rhein.de>
426         patch to show a logo instead of a blank area. Added a suggestion
427         from Alex <alex@cocoa.demon.co.uk>: %%{_localstatedir}/lock/subsys/junkbuster.
428         More regexps in the blocklist. Prepared the forwardfile for
429         squid. Extended image regexp with help from gabriel 
430         <somlo@CS.ColoState.EDU>.
431
432 * Thu Nov 19 1998 Stefan Waldherr <stefan@waldherr.org>
433         All RPMs now identify themselves in the show-proxy-args page.
434         Released Windoze version. Run junkbuster as nobody instead of
435         root. 
436
437 * Fri Oct 30 1998 Stefan Waldherr <stefan@waldherr.org>
438         Newest version. First release (hence the little version number
439         mixture -- 2.0.2-0 instead of 2.0-7). This version tightens 
440         security over 2.0.1; some multi-user sites will need to change 
441         the listen-address in the configuration file. The blank version of
442         the Internet Junkbuster has a more sophisticated way of replacing
443         images. All RPMs identify themselves in the show-proxy-args page.
444
445 * Thu Sep 23 1998 Stefan Waldherr <stefan@waldherr.org>
446         Modified the blocking feature, so that only GIFs and JPEGs are
447         blocked and replaced but not HTML pages. Thanks to 
448         "Gerd Flender" <plgerd@informatik.uni-siegen.de> for this nice
449         idea. Added numerous stuff to the blocklist. Keep patches in
450         seperate files and no longer in diffs (easier to maintain).
451
452 * Tue Jun 16 1998 Stefan Waldherr <swa@cs.cmu.edu>
453         Moved config files to /etc/junkbuster directory, moved man page,
454         added BuildRoot directive (Thanks to Alexey Nogin <ayn2@cornell.edu>)
455         Made new version junkbuster-raw (which is only a stripped version of 
456         the junkuster rpm, i.e. without my blocklist, etc.)
457
458 * Tue Jun 16 1998 (2.0-1)
459         Uhm, not that much. Just a new junkbuster version that
460         fixes a couple of bugs ... and of course a bigger 
461         blocklist with the unique Now-less-ads-than-ever(SM)
462         feature.
463         Oh, one thing: I changed the default user agent to Linux -- no 
464         need anymore to support Apple.
465
466 * Tue Jun 16 1998 (2.0-0)
467         Now-less-ads-than-ever (SM)
468         compiled with gcc instead of cc
469         compiled with -O3, thus it should be a little faster
470         show-proxy-args now works
471         /etc/junkbuster.init wasn't necessary
472
473 * Tue Jun 16 1998 (1.4)
474         some more config files were put into /etc
475         The junkbuster-blank rpm returns a 1x1 pixel image, that gets 
476         displayed by Netscape instead of the blocked image.
477         Read http://www.waldherr.org/junkbuster/ for
478         further info.
479
480 * Tue Jun 16 1998 (1.3)
481         The program has been moved to /usr/sbin (from /usr/local/bin)
482         Init- and stopscripts (/etc/rc.d/rc*) have been added so
483         that the junkbuster starts automatically during bootup.
484         The /etc/blocklist file is much more sophisticated. Theoretically
485         one should e.g. browse all major US and German newspapers without
486         seeing one annoying ad.
487         junkbuster.init was modified. It now starts junkbuster with an
488         additional "-r @" flag.