From 9446cee8d985ff5cf48dc744852fd34f64e64921 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 27 Jan 2016 15:49:02 +0100 Subject: [PATCH 1/3] SPEC: Use systemd macros It's better to do not rely on custom scripts and do not call systemctl directly. This is exactly purpose of systemd-rpm macros. All sections are equivalent excluding "%post common". --- contrib/sssd.spec.in | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in index 76066de9ac8b8ac1f9b14bf3bc787169d317fe2f..354431336b98f5e8cda722438337273b23c3f95c 100644 --- a/contrib/sssd.spec.in +++ b/contrib/sssd.spec.in @@ -1003,24 +1003,13 @@ getent passwd sssd >/dev/null || useradd -r -g sssd -d / -s /sbin/nologin -c "Us %if (0%{?use_systemd} == 1) # systemd %post common -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi +%systemd_post sssd.service %preun common -if [ $1 -eq 0 ] ; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable sssd.service > /dev/null 2>&1 || : - /bin/systemctl stop sssd.service > /dev/null 2>&1 || : -fi +%systemd_preun sssd.service %postun common -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -if [ $1 -ge 1 ] ; then - # Package upgrade, not uninstall - /bin/systemctl try-restart sssd.service >/dev/null 2>&1 || : -fi +%systemd_postun_with_restart sssd.service %else # sysv -- 2.5.0