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
1 changed files with 37 additions and 23 deletions

View File

@ -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 <hhorak@redhat.com> - 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 <hhorak@redhat.com> - 3:1.36-5
- Enhance ypbind(8) with info about NISTIMEOUT