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