diff --git a/ypserv.spec b/ypserv.spec index 110b7f2..67cb7b1 100644 --- a/ypserv.spec +++ b/ypserv.spec @@ -4,7 +4,7 @@ Summary: The NIS (Network Information Service) server Url: http://www.linux-nis.org/nis/ypserv/index.html Name: ypserv Version: 2.29 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: System Environment/Daemons Source0: http://www.linux-nis.org/download/ypserv/ypserv-%{version}.tar.bz2 @@ -129,36 +129,54 @@ EOF install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/rpc.yppasswdd.env %post -# Package with native systemd unit file is installed for the first time -if [ $1 -eq 1 ]; then - # Package install, not upgrade - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi +%if 0%{?systemd_post:1} + %systemd_post ypserv.service + %systemd_post ypxfrd.service + %systemd_post yppasswdd.service +%else + # Package with native systemd unit file is installed for the first time + if [ $1 -eq 1 ]; then + # Package install, not upgrade + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + fi -%triggerun -- ypserv < 2.25-2 -if /sbin/chkconfig --level 3 ypserv ; then - /bin/systemctl --no-reload enable ypserv.service >/dev/null 2>&1 || : -fi -if /sbin/chkconfig --level 3 ypxfrd ; then - /bin/systemctl --no-reload enable ypxfrd.service >/dev/null 2>&1 || : -fi -if /sbin/chkconfig --level 3 yppasswdd ; then - /bin/systemctl --no-reload enable yppasswdd.service >/dev/null 2>&1 || : -fi + %triggerun -- ypserv < 2.25-2 + if /sbin/chkconfig --level 3 ypserv ; then + /bin/systemctl --no-reload enable ypserv.service >/dev/null 2>&1 || : + fi + if /sbin/chkconfig --level 3 ypxfrd ; then + /bin/systemctl --no-reload enable ypxfrd.service >/dev/null 2>&1 || : + fi + if /sbin/chkconfig --level 3 yppasswdd ; then + /bin/systemctl --no-reload enable yppasswdd.service >/dev/null 2>&1 || : + fi +%endif %preun -if [ $1 -eq 0 ] ; then -# Package removal, not upgrade - /bin/systemctl stop ypserv.service ypxfrd.service yppasswdd.service >/dev/null 2>&1 || : - /bin/systemctl --no-reload disable ypserv.service ypxfrd.service yppasswdd.service >/dev/null 2>&1 || : -fi +%if 0%{?systemd_preun:1} + %systemd_preun ypserv.service + %systemd_preun ypxfrd.service + %systemd_preun yppasswdd.service +%else + if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl stop ypserv.service ypxfrd.service yppasswdd.service >/dev/null 2>&1 || : + /bin/systemctl --no-reload disable ypserv.service ypxfrd.service yppasswdd.service >/dev/null 2>&1 || : + fi +%endif %postun -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -if [ "$1" -ge "1" ] ; then -# Package upgrade, not uninstall - /bin/systemctl try-restart ypserv.service ypxfrd.service yppasswdd.service >/dev/null 2>&1 || : -fi +%if 0%{?systemd_postun_with_restart:1} + %systemd_postun_with_restart ypserv.service + %systemd_postun_with_restart ypxfrd.service + %systemd_postun_with_restart yppasswdd.service +%else + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + if [ "$1" -ge "1" ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart ypserv.service ypxfrd.service yppasswdd.service >/dev/null 2>&1 || : + fi +%endif # After switching from gdbm to Tokyo Cabinet we need to rebuild maps # during update, but without pushing to slave servers @@ -190,6 +208,10 @@ NOPUSH=true make -eC /var/yp >&2 || : %{_includedir}/*/* %changelog +* Mon Sep 24 2012 Honza Horak - 2.29-2 +- Use new systemd macros + Resolves: #850376 + * Mon Sep 03 2012 Honza Horak - 2.29-1 - Update to new upstream version that fix memory leaks (Related: #845283) - Use sdnotify to inform systemd that daemons are ready