diff --git a/privoxy.service b/privoxy.service new file mode 100644 index 0000000..9a8f066 --- /dev/null +++ b/privoxy.service @@ -0,0 +1,11 @@ +[Unit] +Description=Privoxy Web Proxy With Advanced Filtering Capabilities +After=network.target + +[Service] +Type=forking +PIDFile=/run/privoxy.pid +ExecStart=/usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy /etc/privoxy/config + +[Install] +WantedBy=multi-user.target diff --git a/privoxy.spec b/privoxy.spec index f07b042..c47e797 100644 --- a/privoxy.spec +++ b/privoxy.spec @@ -6,19 +6,22 @@ Name: privoxy Version: 3.0.16 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Privacy enhancing proxy License: GPLv2+ Source0: http://downloads.sourceforge.net/ijbswa/%{name}-%{version}-%{beta_or_stable}-src.tar.gz +Source1: privoxy.service Patch0: privoxy-3.0.16-chkconfig.patch Patch1: privoxy-3.0.16-configdir.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Group: System Environment/Daemons URL: http://www.privoxy.org/ Requires(pre): shadow-utils -Requires(post): /sbin/chkconfig -Requires(preun): /sbin/chkconfig, /sbin/service -Requires(postun): /sbin/service +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +# For triggerun +Requires(post): systemd-sysv BuildRequires: libtool autoconf pcre-devel zlib-devel %description @@ -51,7 +54,7 @@ mkdir -p %{buildroot}%{_sbindir} \ %{buildroot}%{_mandir}/man1 \ %{buildroot}%{_localstatedir}/log/%{name} \ %{buildroot}%{privoxyconf}/templates \ - %{buildroot}%{_sysconfdir}/rc.d/init.d + %{buildroot}%{_unitdir} # Upstream dropped this one: # %{buildroot}%{_sysconfdir}/logrotate.d @@ -61,7 +64,7 @@ install -p -m 644 templates/* %{buildroot}%{privoxyconf}/templates install -p -m 644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1 # Upstream dropped this one: #install -p -m 644 %{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -install -p -m 755 %{name}-generic.init %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name} +install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service install -p -m 711 -d %{buildroot}%{_localstatedir}/log/%{name} # Customize the configuration file @@ -79,24 +82,38 @@ fi %post # Add privoxy service to management facilities on install -if [ "$1" -eq "1" ]; then - /sbin/chkconfig --add %{name} +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi - %preun # Remove privoxy service from management facilities on erase -if [ "$1" -eq "0" ]; then - /sbin/service %{name} stop > /dev/null 2>&1 ||: - /sbin/chkconfig --del %{name} +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable privoxy.service > /dev/null 2>&1 || : + /bin/systemctl stop privoxy.service > /dev/null 2>&1 || : fi %postun # Restart service if already running on upgrade -if [ "$1" -gt "1" ]; then - /sbin/service %{name} condrestart > /dev/null 2>&1 ||: +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart privoxy.service >/dev/null 2>&1 || : fi +%triggerun -- privoxy < 3.0.16-7 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply privoxy +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save privoxy >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del privoxy >/dev/null 2>&1 || : +/bin/systemctl try-restart privoxy.service >/dev/null 2>&1 || : + + %clean /bin/rm -rf %{buildroot} @@ -109,13 +126,16 @@ fi # Owned by root %defattr(-,root,root,-) #config(noreplace) %{_sysconfdir}/logrotate.d/%{name} -%attr(0755,root,root) %{_initrddir}/%{name} +%attr(0644,root,root) %{_unitdir}/%{name}.service %{_mandir}/man1/%{name}.* %doc README AUTHORS ChangeLog LICENSE %doc doc #doc/source/developer-manual doc/source/faq doc/source/user-manual %changelog +* Thu Apr 19 2012 Jon Ciesla - 3.0.16-7 +- Migrate to systemd, BZ 784090. + * Fri Feb 10 2012 Petr Pisar - 3.0.16-6 - Rebuild against PCRE 8.30 - Rebase chkconfig patch