diff --git a/rusers.spec b/rusers.spec index 2753fe6..8b418c3 100644 --- a/rusers.spec +++ b/rusers.spec @@ -125,35 +125,50 @@ install %SOURCE1 ${RPM_BUILD_ROOT}%{_unitdir}/rusersd.service install %SOURCE3 ${RPM_BUILD_ROOT}%{_unitdir}/rstatd.service %post server -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi - -%triggerun -- rusers-server < 0.17-64 -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -# 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 rstatd rusersd >/dev/null 2>&1 ||: - -# Run these because the SysV package being removed won't do them -/sbin/chkconfig --del rstatd rusersd >/dev/null 2>&1 || : -/bin/systemctl try-restart rstatd.service rusersd.service >/dev/null 2>&1 || : +%if 0%{?systemd_post:1} + %systemd_post rstatd.service + %systemd_post rusersd.service +%else + if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + fi + + %triggerun -- rusers-server < 0.17-64 + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + # 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 rstatd rusersd >/dev/null 2>&1 ||: + + # Run these because the SysV package being removed won't do them + /sbin/chkconfig --del rstatd rusersd >/dev/null 2>&1 || : + /bin/systemctl try-restart rstatd.service rusersd.service >/dev/null 2>&1 || : +%endif %preun server -if [ $1 = 0 ]; then -# Package removal, not upgrade - /bin/systemctl --no-reload disable rstatd.service rusersd.service > /dev/null 2>&1 || : - /bin/systemctl stop rstatd.service rusersd.service > /dev/null 2>&1 || : -fi +%if 0%{?systemd_preun:1} + %systemd_preun rstatd.service + %systemd_preun rusersd.service +%else + if [ $1 = 0 ]; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable rstatd.service rusersd.service > /dev/null 2>&1 || : + /bin/systemctl stop rstatd.service rusersd.service > /dev/null 2>&1 || : + fi +%endif %postun server -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -if [ $1 -ge 1 ] ; then - # Package upgrade, not uninstall - /bin/systemctl try-restart rstatd.service rusersd.service >/dev/null 2>&1 || : -fi +%if 0%{?systemd_postun_with_restart:1} + %systemd_postun_with_restart rstatd.service + %systemd_postun_with_restart rusersd.service +%else + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart rstatd.service rusersd.service >/dev/null 2>&1 || : + fi +%endif %files %doc README @@ -171,6 +186,7 @@ fi %changelog * Tue Sep 11 2012 Honza Horak - 0.17-70 - Minor spec file changes +- Use new systemd macros (Resolves: #850302) * Sat Jul 21 2012 Fedora Release Engineering - 0.17-69 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild