Use new systemd macros (Resolves: #850375)

This commit is contained in:
Honza Horák 2012-09-24 13:21:11 +02:00
parent 41e631bfff
commit 1c9957c36c

View File

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