File privoxy.spec of Package privoxy

#
# spec file for package privoxy (Version 3.0.16)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           privoxy
BuildRequires:  pcre-devel w3m zlib-devel
Url:            http://www.privoxy.org/
License:        GPLv2+
Group:          Productivity/Networking/Web/Proxy
Provides:       ijb junkbuster
Obsoletes:      ijb junkbuster
AutoReqProv:    on
PreReq:         %fillup_prereq %insserv_prereq /usr/sbin/useradd /usr/sbin/groupadd
Version:        3.0.16
Release:        1
Summary:        The Internet Junkbuster - HTTP Proxy Server
Source:         privoxy-%{version}-stable-src.tar.bz2
Source1:        privoxy.logrotate
Source2:        %{name}-%{version}-init.suse
Patch1:         %{name}-%{version}-config.patch
Patch2:         %{name}-%{version}-utf8.patch
Patch3:         %{name}-%{version}-networkmanager.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       logrotate cron
%define chroot /var/lib/privoxy

%description
The Internet Junkbuster - HTTP Proxy Server: A non-caching HTTP proxy
server that runs between a web browser and a web server and filters
contents as described in the configuration files.



Authors:
--------
    Privoxy Developers <developers@privoxy.org>

%package doc
Group:          Productivity/Networking/Web/Proxy
License:        GPLv2+
Summary:        The documentation of Privoxy
Requires:       %{name} = %{version}

%description doc
Documentation files for the Privoxy: The Internet Junkbuster - HTTP
Proxy Server. A non-caching HTTP proxy server that runs between a web
browser and a web server and filters contents as described in the
configuration files.



Authors:
--------
    Privoxy Developers <developers@privoxy.org>

%prep
%setup -q -n privoxy-%{version}-stable
%patch1
%patch2 -p0
%patch3

%build
autoreconf -fiv
%configure --enable-zlib
make

%install
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
mkdir -p $RPM_BUILD_ROOT/%chroot/etc
mkdir -p $RPM_BUILD_ROOT/usr/sbin
mkdir -p $RPM_BUILD_ROOT/%chroot/log
mkdir -p $RPM_BUILD_ROOT/%chroot/var/log
mkdir -p $RPM_BUILD_ROOT/%chroot/var/run
mkdir -p $RPM_BUILD_ROOT/%chroot/%_lib
mkdir -p $RPM_BUILD_ROOT%_mandir/man1
mkdir -p $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d
cp -a templates $RPM_BUILD_ROOT/%chroot/etc
install -m 644 config *.action *.filter trust $RPM_BUILD_ROOT/%chroot/etc
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d/privoxyd
install -m 755 privoxy $RPM_BUILD_ROOT/usr/sbin
install -m 755 privoxy_nm $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/privoxyd
install -m 644 privoxy.1 $RPM_BUILD_ROOT%_mandir/man1
ln -sf ../../etc/init.d/privoxyd $RPM_BUILD_ROOT/usr/sbin/rcprivoxyd
ln -sf ../../etc/init.d/privoxyd $RPM_BUILD_ROOT/usr/sbin/rcprivoxy
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/privoxy
ln -s ../../log $RPM_BUILD_ROOT/%chroot/var/log/privoxy
ln -sf %chroot/etc/ $RPM_BUILD_ROOT/etc/privoxy

%pre
/usr/sbin/groupadd -r privoxy 2> /dev/null ||:
/usr/sbin/useradd -r -g privoxy -s /bin/false -c "Daemon user for privoxy" \
 -d /var/lib/privoxy privoxy 2> /dev/null ||:
exit 0

%post
%{fillup_and_insserv privoxyd}
# create logfiles if missing
for i in ./%chroot/log/logfile ./%chroot/log/jarfile; do
	if ! test -e $i; then touch $i; chown privoxy: $i; chmod 640 $i ; fi
done
exit 0

%preun
%stop_on_removal privoxyd

%postun
%restart_on_update privoxyd
%insserv_cleanup

%files
%defattr(-,root,root)
%doc AUTHORS LICENSE README ChangeLog
/usr/sbin/privoxy
/etc/NetworkManager/dispatcher.d/privoxyd
%dir /etc/NetworkManager
%dir /etc/NetworkManager/dispatcher.d
%doc %_mandir/man1/privoxy.1.gz
%config(noreplace) /etc/logrotate.d/privoxy
%dir /%chroot/etc
%config(noreplace) /%chroot/etc/config
%config(noreplace) /%chroot/etc/trust
%config                                    /%chroot/etc/match-all.action
%config            %attr(640,privoxy,root) /%chroot/etc/default.action
%config(noreplace) %attr(640,privoxy,root) /%chroot/etc/user.action
%config(noreplace) /%chroot/etc/*.filter
%dir %chroot
%chroot/etc/templates
%dir %attr(770,root,privoxy) %chroot/log
%chroot/var
%chroot/%_lib
%chroot/etc/regression-tests.action
%config /etc/init.d/privoxyd
/usr/sbin/rcprivoxyd
/usr/sbin/rcprivoxy
/etc/privoxy

%files doc
%defattr(-,root,root)
%doc doc/source

%changelog