diff --git a/ypbind.spec b/ypbind.spec index 302be4a..76c17fe 100644 --- a/ypbind.spec +++ b/ypbind.spec @@ -78,35 +78,47 @@ install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/ypbind-post-waitbind %{find_lang} %{name} %post -# Package install, not upgrade -if [ $1 -eq 1 ]; then - /bin/systemctl daemon-reload >dev/null || : -fi +%if 0%{?systemd_post:1} + %systemd_post %{name}.service +%else + # Package install, not upgrade + if [ $1 -eq 1 ]; then + /bin/systemctl daemon-reload >dev/null || : + fi -# Package with native systemd unit file is installed for the first time -%triggerun -- ypbind < 3:1.32-9 -# Save the current service runlevel info -# User must manually run systemd-sysv-convert --apply httpd -# to migrate them to systemd targets -/usr/bin/systemd-sysv-convert --save ypbind >/dev/null 2>&1 ||: + # Package with native systemd unit file is installed for the first time + %triggerun -- %{name} < 3:1.32-9 + # Save the current service runlevel info + # User must manually run systemd-sysv-convert --apply httpd + # to migrate them to systemd targets + /usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||: -# Run these because the SysV package being removed won't do them -/sbin/chkconfig --del ypbind >/dev/null 2>&1 || : -/bin/systemctl try-restart ypbind.service >/dev/null 2>&1 || : + # Run these because the SysV package being removed won't do them + /sbin/chkconfig --del %{name} >/dev/null 2>&1 || : + /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +%endif %preun -if [ $1 -eq 0 ] ; then -# Package removal, not upgrade - /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || : - /bin/systemctl stop %{name}.service >/dev/null 2>&1 || : -fi +%if 0%{?systemd_preun:1} + %systemd_preun %{name}.service +%else + if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || : + /bin/systemctl stop %{name}.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 %{name}.service >/dev/null 2>&1 || : -fi +%if 0%{?systemd_postun_with_restart:1} + %systemd_postun_with_restart %{name}.service +%else + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + if [ "$1" -ge "1" ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : + fi +%endif %files -f %{name}.lang %{_sbindir}/* @@ -122,6 +134,8 @@ fi * Mon Sep 24 2012 Honza Horak - 3:1.36-6 - Use sdnotify to inform systemd that daemon is ready - Minor spec file cleanup +- Use new systemd macros + Resolves: #850375 * Thu Aug 23 2012 Honza Horak - 3:1.36-5 - Enhance ypbind(8) with info about NISTIMEOUT