Sophie

Sophie

distrib > Fedora > 16 > x86_64 > by-pkgid > a252b6b268703104b44f8620c723a14b > files > 10

polipo-1.0.4.1-6.fc16.src.rpm

# tmpfiles.d support starts in Fedora 15
%if 0%{?fedora} && 0%{?fedora} > 14
%global _with_tmpfilesd 1
%endif

# systemd was introduced in Fedora 15, but we don't support it until Fedora 17
%if 0%{?fedora} && 0%{?fedora} > 16
%global _with_systemd 1
%endif

Name:           polipo
Version:        1.0.4.1
Release:        6%{?dist}
Summary:        Lightweight caching web proxy
License:        MIT
Source0:        http://freehaven.net/~chrisd/%{name}/%{name}-%{version}.tar.gz
Source1:        %{name}.init
Source2:        %{name}.config
Source3:        %{name}.forbidden
Source4:        %{name}.logrotate
Source5:        %{name}.nm
Source6:        %{name}.tmpfiles
Source7:        %{name}.service
Source8:        %{name}.cron
Patch0:         http-assertion-failure.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Group:          System Environment/Daemons
URL:            http://www.pps.jussieu.fr/~jch/software/%{name}/
BuildRequires:  texinfo
%if 0%{?_with_systemd}
BuildRequires:  systemd-units
%endif
Requires:       logrotate
Requires(post): info
Requires(preun):info
Requires(pre):  shadow-utils
Requires(post): chkconfig
Requires(preun):chkconfig

Requires(pre):  %{_sbindir}/useradd

%if 0%{?_with_systemd}
Requires(preun):systemd-units
Requires(post): systemd-units, %{_sbindir}/usermod
Requires(postun):systemd-units
%else
Requires(preun):initscripts, chkconfig
Requires(post): initscripts, chkconfig, %{_sbindir}/usermod
Requires(postun):initscripts
%endif


%description
Polipo is a lightweight caching web proxy that was designed as a personal
cache. It is able to cache incomplete objects and will complete them using
range requests. It will use HTTP/1.1 pipelining if supported by the remote
server.

%prep
%setup -q

%patch0 -p1 -b .http-assertion-failure

%build
make %{?_smp_mflags} PREFIX=%{_prefix} BINDIR=%{_bindir} CDEBUGFLAGS="%{optflags}"

%install
rm -rf $RPM_BUILD_ROOT
make install PREFIX=%{_prefix} BINDIR=%{_bindir} MANDIR=%{_mandir} \
    INFODIR=%{_infodir} TARGET=$RPM_BUILD_ROOT
install -m 0755 -d $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
install -m 0750 -d $RPM_BUILD_ROOT/%{_localstatedir}/cache/%{name}
install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/config
install -D -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/forbidden
install -D -p -m 0644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}
install -D -p -m 0755 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/NetworkManager/dispatcher.d/25-%{name}
install -D -p -m 0755 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/%{name}

%if 0%{?_with_tmpfilesd}
install -D -p -m 0644 %{SOURCE6} $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/%{name}.conf
%endif
install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/run/%{name}

%if 0%{?_with_systemd}
install -D -p -m 0644 %{SOURCE7} $RPM_BUILD_ROOT/%{_unitdir}/%{name}.service
%else
install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initddir}/%{name}
%endif

rm -f $RPM_BUILD_ROOT/%{_infodir}/dir

%clean
rm -rf $RPM_BUILD_ROOT

%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d %{_localstatedir}/cache/%{name} -s /sbin/nologin -c "Polipo Web Proxy" %{name}
for i in %{_localstatedir}/run/%{name} %{_localstatedir}/cache/%{name} ; do
    if [ -d $i ] ; then
        for adir in `find $i -maxdepth 0 \! -user %{name}`; do
            /bin/chown -Rf %{name}:%{name} $adir
            /bin/chmod -Rf u+rwX $adir
        done
    fi
done
exit 0

%post
[ -e %{_localstatedir}/log/%{name} ] || /bin/touch %{_localstatedir}/log/%{name}
/bin/chmod -f 0640 %{_localstatedir}/log/%{name}
/bin/chown -f %{name}:%{name} %{_localstatedir}/log/%{name}
/sbin/restorecon /var/log/polipo || :

/sbin/install-info --quiet --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz || : 

if [ $1 -eq 1 ]; then
    # package install, not upgrade

%if 0%{?_with_systemd}
    /bin/systemctl daemon-reload > /dev/null 2>&1 || :
%else
    /sbin/chkconfig --add %{name} || :
%endif

fi

%preun
if [ $1 = 0 ] ; then
    # package removal, not upgrade

%if 0%{?_with_systemd}
    /sbin/systemctl disable %{name}.service > /dev/null 2>&1 || :
    /sbin/systemctl stop %{name}.service > /dev/null 2>&1 || :
%else
    /sbin/service %{name} stop >/dev/null 2>&1 || :
    /sbin/chkconfig --del %{name} || :
%endif

    /sbin/install-info --quiet --info-dir=%{_infodir} --delete %{_infodir}/%{name}.info.gz || :
fi

%postun
%if 0%{?_with_systemd}
    /bin/systemctl daemon-reload > /dev/null 2>&1 || :
%endif

if [ $1 -ge 1 ] ; then
    # package upgrade, not uninstall

%if 0%{?_with_systemd}
    /bin/systemctl try-restart %{name}.service > /dev/null 2>&1 || :
%else
    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
%endif

fi

%if 0%{?_with_systemd}
%triggerun -- %{name} < 1.0.4.1-4
if /sbin/chkconfig %{name}; then
    /bin/systemctl enable %{name}.service > /dev/null 2>&1 || :
fi
%endif

%files
%defattr(-,root,root,-)
%doc README CHANGES COPYING *.sample
%dir %{_sysconfdir}/%{name}
%dir %{_datadir}/%{name}
%attr(0750,%{name},%{name}) %dir %{_localstatedir}/cache/%{name}
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_mandir}/man1/%{name}.*
%{_infodir}/%{name}.*
%config(noreplace) %{_sysconfdir}/%{name}/config
%config(noreplace) %{_sysconfdir}/%{name}/forbidden
%attr(0755,root,root) %{_sysconfdir}/NetworkManager/dispatcher.d/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%attr(0755,root,root) %{_sysconfdir}/cron.daily/%{name}

%if 0%{?_with_systemd}
%{_unitdir}/%{name}.service
%else
%attr(0755,root,root) %{_initddir}/%{name}
%endif

%if 0%{?_with_tmpfilesd}
%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
%endif
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}

%changelog
* Sun Jan 22 2012 Bernard Johnson <bjohnson@symetrix.com> - 1.0.4.1-6
- add daily cache cleanup
- fix missing creation of /var/run directory (bz #755198)
- make sure log directory context is set correctly (bz #741779)
- fix denial of service vulnerability CVE-2011-3596 (bz #742897)

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Sep 26 2011 Bernard Johnson <bjohnson@symetrix.com> - 1.0.4.1-4
- take file / dir creation & testing out of initscript (bz #708814)
- remove log file / dir creation in spec too
- NetworkManager integration should use restart rather than reload (bz #699677)
- add support for tmpfiles.d (bz #656669)
- add support for systemd starting in F17

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sun Feb 21 2010 Chen Lei <supercyper@163.com> 1.0.4.1-2
- fix for rpmlint warnings

* Sun Feb 21 2010 Chen Lei <supercyper@163.com> 1.0.4.1-1
- initial rpm build