File privoxy.spec of Package privoxy

#
# spec file for package privoxy (Version 3.0.3)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org
#

# norootforbuild

Name:         privoxy
BuildRequires: pcre-devel w3m
URL:          http://www.privoxy.org/
License:      GPL
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.6
Release:      3
Summary:      The Internet Junkbuster - HTTP Proxy Server
Source:       privoxy-%version-stable-src.tar.bz2
Source1:      privoxy.logrotate
Patch:        %{name}-%{version}-init.patch
Patch1:       %{name}-%{version}-config.patch
Patch2:       %{name}-%{version}-utf8.patch
Patch3:       %{name}-%{version}-networkmanager.patch
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
%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>

%prep
%setup -q -n privoxy-%version-stable
%patch -p1
%patch1
%patch2 -p0
%patch3

%build
autoheader
autoconf
CFLAGS="$RPM_OPT_FLAGS" ./configure
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 privoxy.init.suse $RPM_BUILD_ROOT/etc/init.d/privoxy
install -m 755 privoxy $RPM_BUILD_ROOT/usr/sbin
install -m 755 privoxy_nm $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/privoxy
install -m 644 privoxy.1 $RPM_BUILD_ROOT%_mandir/man1
ln -sf ../../etc/init.d/privoxy $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 -s privoxy START_IJB}
# 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 privoxy

%postun
%restart_on_update privoxy
%insserv_cleanup

%files
%defattr(-,root,root)
%doc AUTHORS LICENSE README ChangeLog
%doc doc/text
/usr/sbin/privoxy
/etc/NetworkManager/dispatcher.d/privoxy
%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/standard.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
%config /etc/init.d/privoxy
/usr/sbin/rcprivoxy
/etc/privoxy

%changelog -n privoxy
* Tue Mar 06 2007 - lmichnovic@suse.cz
- added symlink into /etc to real config dir /var/lib/privoxy/etc
* Thu Dec 07 2006 - lmichnovic@suse.cz
- Initial version in BS 3.0.6 stable
openSUSE Build Service is sponsored by