From d23012279c20fe4d61b3c3472aca99cd5d89d546f811a015f0d1f97138e8ba0b Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 28 Feb 2012 15:45:40 +0000 Subject: [PATCH] Add rc symlinks, guard systemd lines OBS-URL: https://build.opensuse.org/package/show/server:http/varnish?expand=0&rev=55 --- varnish.spec | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/varnish.spec b/varnish.spec index 861e206..9584ffa 100644 --- a/varnish.spec +++ b/varnish.spec @@ -106,32 +106,33 @@ export CFLAGS="%optflags -fstack-protector" make %{?_smp_mflags} %install +b="%buildroot"; %makeinstall -find %buildroot -ls # There is no use for them to normal users -mv %buildroot/%_bindir/* %buildroot/%_sbindir/ -# -# remove unneeded files -# libvarnish.la has -lrt as dependency lib -#rm -fv %buildroot%_libdir/*.la +mv "$b/%_bindir"/* "$b/%_sbindir/"; # ##missing directories -install -d -m 0755 %buildroot{%pkg_logdir,%pkg_home} -install -Dpm 0644 %{S:5} %buildroot%_sysconfdir/logrotate.d/varnish +install -dm 0755 "$b"/{%pkg_logdir,%pkg_home}; +install -Dpm 0644 "%{S:5}" "$b/%_sysconfdir/logrotate.d/varnish"; # ##init scripts -install -Dpm 0644 %{S:3} %buildroot/var/adm/fillup-templates/sysconfig.%name -install -Dpm 0755 %{S:2} %buildroot/%_initddir/varnish -install -Dpm 0755 %{S:6} %buildroot/%_initddir/varnishlog -install -Dpm 0644 "%{S:7}" "%buildroot/lib/systemd/system/varnish.service"; -install -Dpm 0644 "%{S:8}" "%buildroot/lib/systemd/system/varnishlog.service"; +install -Dpm 0644 "%{S:3}" "$b/var/adm/fillup-templates/sysconfig.%name"; +install -Dpm 0755 "%{S:2}" "$b/%_initddir/varnish"; +install -Dpm 0755 "%{S:6}" "$b/%_initddir/varnishlog"; +%if 0%{?_unitdir:1} +install -Dpm 0644 "%{S:7}" "$b/%_unitdir/varnish.service"; +install -Dpm 0644 "%{S:8}" "$b/%_unitdir/varnishlog.service"; +%endif +mkdir -p "$b/%_sbindir"; +ln -s "%_initddir/varnish" "$b/%_sbindir/rcvarnish"; +ln -s "%_initddir/varnishlog" "$b/%_sbindir/rcvarnishlog"; # ##config files -install -Dpm 0644 %{S:4} %buildroot%_sysconfdir/%name/vcl.conf -install -Dpm 0644 %{S:4} %buildroot%_sysconfdir/%name/vcl.conf.example +install -Dpm 0644 %{S:4} "$b/%_sysconfdir/%name/vcl.conf"; +install -Dpm 0644 %{S:4} "$b/%_sysconfdir/%name/vcl.conf.example"; -find "%buildroot" -type f -name "*.la" -delete -mkdir -p "%buildroot/%pkg_logdir" +find "$b" -type f -name "*.la" -delete +mkdir -p "$b/%pkg_logdir" %pre %_bindir/getent group varnish >/dev/null || \ @@ -139,27 +140,35 @@ 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 || : +%if 0%{?service_add_pre:1} %service_add_pre varnish.service %service_add_pre varnishlog.service +%endif %post %fillup_and_insserv varnish %fillup_and_insserv varnishlog +%if 0%{?service_add_post:1} %service_add_post varnish.service %service_add_post varnishlog.service +%endif %preun %stop_on_removal varnish %stop_on_removal varnishlog +%if 0%{?service_del_preun:1} %service_del_preun varnish.service %service_del_preun varnishlog.service +%endif %postun # Does not this very much conflict? But rpmlint wants to have it... %restart_on_update varnish %restart_on_update varnishlog +%if 0%{?service_del_postun:1} %service_del_postun varnish.service %service_del_postun varnishlog.service +%endif %insserv_cleanup %post -n %library_name -p /sbin/ldconfig @@ -169,7 +178,9 @@ mkdir -p "%buildroot/%pkg_logdir" %defattr(-,root,root) %_initddir/varnish %_initddir/varnishlog +%if 0%{?_unitdir:1} %_unitdir +%endif %config(noreplace) %_sysconfdir/logrotate.d/varnish %dir %attr(0750,root,varnish) %_sysconfdir/%name/ %config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/vcl.conf @@ -177,6 +188,7 @@ mkdir -p "%buildroot/%pkg_logdir" %config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/default.vcl %_libdir/varnish %_sbindir/varnish* +%_sbindir/rcvarnish* %_mandir/man*/* %doc ChangeLog LICENSE README %dir %attr(0750,varnish,varnish) %pkg_home