diff --git a/varnish.spec b/varnish.spec index 954f930..861e206 100644 --- a/varnish.spec +++ b/varnish.spec @@ -41,6 +41,10 @@ Prereq(post): %_sbindir/useradd %_sbindir/groupadd %if 0%{?suse_version} >= 1010 Recommends: logrotate %endif +%if 0%{?suse_version} >= 1140 +BuildRequires: systemd +%{?systemd_requires} +%endif %define pkg_home %_localstatedir/lib/%name %define pkg_logdir %_localstatedir/log/%name %define pkg_cachedir %_localstatedir/cache/%name @@ -135,18 +139,27 @@ mkdir -p "%buildroot/%pkg_logdir" %_bindir/getent passwd varnish >/dev/null || \ %_sbindir/useradd -g varnish -s /bin/false -r -c "user for Varnish" \ -d %pkg_home varnish || : +%service_add_pre varnish.service +%service_add_pre varnishlog.service %post %fillup_and_insserv varnish %fillup_and_insserv varnishlog +%service_add_post varnish.service +%service_add_post varnishlog.service %preun %stop_on_removal varnish %stop_on_removal varnishlog +%service_del_preun varnish.service +%service_del_preun varnishlog.service %postun +# Does not this very much conflict? But rpmlint wants to have it... %restart_on_update varnish %restart_on_update varnishlog +%service_del_postun varnish.service +%service_del_postun varnishlog.service %insserv_cleanup %post -n %library_name -p /sbin/ldconfig @@ -156,7 +169,7 @@ mkdir -p "%buildroot/%pkg_logdir" %defattr(-,root,root) %_initddir/varnish %_initddir/varnishlog -/lib/systemd +%_unitdir %config(noreplace) %_sysconfdir/logrotate.d/varnish %dir %attr(0750,root,varnish) %_sysconfdir/%name/ %config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/vcl.conf